Uri class and parser

Mike van Dongen dlang at mikevandongen.nl
Thu Nov 8 15:13:59 PST 2012


On Thursday, 8 November 2012 at 17:02:25 UTC, jerro wrote:
>> Thnx. Got myself some new errors ;)
>> It seems that std.string.indexOf() does not work at compile 
>> time. Is there a solution or alternative method for this?
>
> I guess the proper solution would be to make std.string.indexOf 
> work at compile time. It looks like changing the first
>
> if (std.ascii.isASCII(c))
>
> line in std.string.indexOf to
>
> if (!__ctfe && std.ascii.isASCII(c))
>
>
> Makes it work at compile time.

After trying your solution I found out I was calling 
indexOf(string, char) which apparently is different than 
indexOf(string, string) as I now no longer have that error.
Instead, when I call parse on compile time I get the following at 
the method parse:
Error: URI class literals cannot be returned from CTFE

The method returns an instance of class URI and works perfectly 
when called at runtime.
As far as I can see it has nothing to do with my previous 
problem. I do thank you for your answer.


More information about the Digitalmars-d mailing list