Create const regex?
Rikki Cattermole via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jun 6 05:08:38 PDT 2014
On 7/06/2014 12:01 a.m., AntonSotov wrote:
> const r1 = regex("bla");
> matchFirst( "big string", r1 ); // ERROR!
>
> immutable r2 = regex("bla"); // ERROR!
>
> Why can I not use const/immutable regex?
In none of your examples you have not defined the type of the variables.
However you are giving it an access modifier.
I assume you are wanting auto.
import std.regex;
void main() {
const auto r1 = regex("bla");
pragma(msg, typeof(r1));
}
Compilation output:
const(Regex!char)
More information about the Digitalmars-d-learn
mailing list