www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Splitter.opSlice(), ranges and const strings

Hi!

I've run into an issue which I don't understand.

Boiled down code:
import std.regex;

void main()
{
       //string str = "sdf"; // works
       //const string str = "sdf"; // doesn't work
       immutable str = "sdf"; // doesn't work
       auto pat = regex(", *");
       auto split = splitter(str, pat);
}

Error:
/Library/Compilers/dmd2/osx/bin/../../src/phobos/std/regex.d(3022):
Error: this is not mutable

Should splitter() be able to cope with const/immutable ranges?

(That's with the latest official v2.052 dmd/phobos distribution for
mac. I got the same error before upgrading from the v2.051
also).
Feb 23 2011