Original Post
[EDITED...] I've run into a problem that could be fixed if only this would work: (example)
template<bool on = true>
class test{
public:
void do_test()
{
#if (on)
cout << "Test is: ON"
#else
cout << "Test is: OFF"
#endif
<< endl;
}
};
int main
{
test<> t;
test<false> t1;
t.do_test();
t1.do_test();
return 0;
}
The behavior requested should be obvious.... but... it doesn't work. The preprocessor doesn't pick up the compile-time constant. The conditional compilation is mandatory, because the passed-in parameter type will refuse to compile for certain types... (the line it chokes on needs to be conditionally compiled out) Is there a way to do this? (The application in question is a templated member function that deduces a type based on the parameter) Thanks for any ideas. Chad [Edited by - Verg on September 7, 2005 10:45:34 PM]