compile-time variables?

BCS ao at pathlink.com
Thu May 24 15:08:23 PDT 2007


Reply to Fraser,

> BCS Wrote:
> 
>> ...
>> 
>> const int Baz = 0;
>> pragma(msg, "#define Baz 0\n")
>> template Foo(A...)
>> {
>> pragma{msg,"template
>> Foo("~convert_Tuple_To_Args_List_And_Specilization!(A)~"){const
>> int Foo = Baz;}\n#define Baz (Baz+1)\n")
>> }
>> Use this Foo everywhere you need it (with enough stuff in A to make
>> each
>> use unique).
>> Compile everything, pipe through cpp, recompile with the resulting
>> code in
>> place of the original code.
>> I will now retreat to my lair to repent for that blasphemy. <g>
>> 
> Heh; works like a charm! Thanks for that hackery!
> 

<joking>If you are actually doing this, please send me you name so that I 
can be sure to never hire you.</joking>





More information about the Digitalmars-d mailing list