CTFE implementation
Don Clugston
dac at nospam.com.au
Mon Feb 11 23:59:51 PST 2008
Frank Benoit wrote:
> Don Clugston schrieb:
>> Looks like a CTFE bug.
>> Try creating the GUID struct in place, that often works better.
>>
>> return GUID(HexToInt( str[1 .. 9] ), ...
>> [HexToInt( str[25+2*0 .. 25+2*0], ...
>> ,HexToInt( str[25+2*5 .. 25+2*5]] );
>
> I tried this without luck:
opCall definitely won't work with CTFE yet. But struct constructors work in
every case I've ever tried.
> struct __GUID{
> static __GUID opCall( uint Data1_, ushort Data2_, ushort Data3_,
> ubyte[8] Data4_ ){
> __GUID s;
> s.Data1 = Data1_;
> s.Data2 = Data2_;
> s.Data3 = Data3_;
> s.Data4[0..8] = Data4_[0..8];
> return s;
> }
> align(1):
> uint Data1;
> ushort Data2;
> ushort Data3;
> ubyte[8] Data4;
> }
> alias __GUID GUID;
>
> GUID IIDFromString(char[] d) {
> return GUID(1,2,3,[0,1,2,3,4,5,6,7]);
> }
>
>
>
More information about the Digitalmars-d-learn
mailing list