Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-09-01 13:26:30


"Peder Holt" <peder.holt_at_[hidden]> 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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk