Why can't a Regex object be immutable?
cym13 via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jan 1 18:12:18 PST 2016
On Saturday, 2 January 2016 at 02:03:13 UTC, Shriramana Sharma
wrote:
> 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.
More information about the Digitalmars-d-learn
mailing list