CTFE implementation

Don Clugston dac at nospam.com.au
Tue Feb 12 05:06:52 PST 2008


Frank Benoit wrote:
> Don Clugston schrieb:
>> Looks like a CTFE bug.
>> Try creating the GUID struct in place, that often works better.

This works.  I reduced the size of Data4 bcos I was lazy -- you'll need to add 
the other 4 members

private static GUID IIDFromString( char[] str ){
     assert( str.length is 38 );
     assert( str[0] is '{' );
     assert( str[9] is '-' );
     assert( str[14] is '-' );
     assert( str[19] is '-' );
     assert( str[24] is '-' );
     assert( str[37] is '}' );
     return GUID(HexToInt( str[1 .. 9] ),  HexToInt( str[10 .. 14] ),
             HexToInt( str[15 .. 19]),
         [cast(ubyte)HexToInt( str[20 .. 22] ), HexToInt( str[22 .. 24] ),
         HexToInt( str[25+2 .. 25+1*2]),HexToInt( str[25+1*2 .. 25+2*2]),
// other 4 entries...]);
}

const GUID IIDJavaBeansBridge = 
IIDFromString("{8AD9C840-044E-11D1-B3E9-00805F499D93}");


More information about the Digitalmars-d-learn mailing list