Uri class and parser
Mike van Dongen
dlang at mikevandongen.nl
Thu Nov 8 08:42:13 PST 2012
On Thursday, 8 November 2012 at 15:32:59 UTC, jerro wrote:
>> Something entirely else is the CTFE compatibility of URI. At
>> first I though that because a new instance of URI can be
>> created as a const, it would be evaluated on compile time.
>> This is part of how I test CTFE at the moment:
>>
>> const URI uri36 = URI.parse("http://dlang.org/");
>> assert(uri36.scheme == "http");
>>
>> I tried changing 'const' to 'static' but that resulted in an
>> error.
>> (_adSort cannot be interpreted at compile time, because it has
>> no available source code)
>>
>> Now I'm not sure anymore how to test if my code meets the CTFE
>> requirements.
>
> To force something to be evaluated at compile time, you can
> assign it to an enum, like this:
>
> enum uri = URI.parse("http://dlang.org/");
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?
More information about the Digitalmars-d
mailing list