Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-04-21 16:15:53


"Paul Mensonides" <pmenso57_at_[hidden]> wrote

> > The MS preprocessor has the __COUNTER__ extension that
> > expands to the next integer every time when used. Can
> > something like this be achieved in a portable manner, maybe
> > with the help of Boost.Preprocessor library?
>
> The best you can do in standard C++ is __LINE__. If you need varying
numbers
> all in the same place (i.e. the same header), you can manually keep track
of a
> counter. It is also possible to hijack the #include mechanism to provide
a
> different number each time a file is included or something like that. In
any
> case, the ways of doing it are a lot more heavyweight than __COUNTER__,
but a
> lot more standard too.

Actually I don't need to have many things on the same line, but I do want to
handle inclusions from several headers... Maybe it's somehow possible to
generate a unique number from the header file name? Or use this #include
mechanism you mentioned?

Thanks,
Arkadiy


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