CTFE implementation
Frank Benoit
keinfarbton at googlemail.com
Mon Feb 11 11:08:07 PST 2008
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:
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