
"Peder Holt" <peder.holt@gmail.com> wrote
As to the implementation of my code, I got the inspiration to my implementation from Daniel Wallins post some time back on compile time constants: http://lists.boost.org/MailArchives/boost/msg69842.php
I compiled this code in VC7.1, and it did compile although with warnings. But then I modified main to look like this: int main() { SET(X, 10); std::cout << CURRENT(X) << "\n"; std::cout << VALUE(X) << "\n"; SET(X, 15); std::cout << CURRENT(X) << "\n"; std::cout << VALUE(X) << "\n"; SET(X, 20); std::cout << CURRENT(X) << "\n"; std::cout << VALUE(X) << "\n"; SET(X, 15); std::cout << CURRENT(X) << "\n"; std::cout << VALUE(X) << "\n"; } the output was somewhat different than one would expect: 1 10 2 15 3 20 3 -- wrong 20 -- wrong How do you handle this in your typeof implementation? Do you reset it somehow between typeofs? Or do you start from the next available number? Regards, Arkadiy