From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2004-04-21 17:35:44
"Arkadiy Vertleyb" <vertleyb_at_[hidden]> wrote:
[snip __COUNTER__ macro question]
> Actually I don't need to have many things on the same line, but I do want
> 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?
__FILE__/__LINE__ combination is unique across multile TUs.
But it is AFAIK impossible to translate it into numeric value
(preprocessor sees string as one token)
and const char* cannot be used as template parameter.
Though you can name headers as hdr1.hpp, hdr2.hpp, ...
and extract the unique header number via
__FILE__[sizeof(__FILE__) - 6]
hack to get its ASCII code.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk