(Manifest) constants inside structs
Robert Fraser
fraserofthenight at gmail.com
Tue Jan 22 17:57:10 PST 2008
Sönke Ludwig wrote:
> Finally found a dirty hack that works:
>
> T ct_strip_const_helper(T)( const(T)[] t ){ return (cast(T[])t)[0]; }
> T ct_strip_const(T)( const(T) t ){ return ct_strip_const_helper([t]); }
>
> struct S {
> static const S ess_const = {1};
>
> int member;
> }
>
>
> struct T {
> static const T tee_const = {ct_strip_const(S.ess_const)};
>
> S member;
> }
Eww! Here's to hoping the enum-in-structs thing gets fixed.
More information about the Digitalmars-d
mailing list