Shriramana Sharma wrote:Why is it impossible for a Regex object to be `immutable`?I find that I can't declare it as `const` either... This is most curious!
I think it's because regex() only compiles the regex at runtime so it needs to be modified later ; you'll find that using ctRegex() instead will allow you to declare it immutable for example. I didn't look at the implementation to identify a precise cause though.