Create const regex?

hane via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 7 09:15:46 PDT 2014


On Saturday, 7 June 2014 at 11:33:35 UTC, Meta wrote:
> On Saturday, 7 June 2014 at 00:48:59 UTC, hane wrote:
>> On Friday, 6 June 2014 at 15:42:41 UTC, Meta wrote:
>>> You should not do this, as it will create a new regex 
>>> everywhere you use it. Unlike const or immutable, enum in 
>>> this situation is more or less like a C macro.
>>>
>>> #define r1 regex("bla")
>>
>> I see. Thanks.
>
> Do you remember where you saw this in Phobos? It was probably 
> unintended, and should be removed.

At std.regex.


BTW, I found that immutable regex can be created with enum.
     enum r1_ = regex("bla");
     immutable r1 = r1_;
Regex struct created during compiling can be immutable?


More information about the Digitalmars-d-learn mailing list