
"Jody Hagins" <jody-boost-011304@atdesk.com> wrote
There are two problems I can see here. One is related to getting a unique integer (what I am using __COUNTER__ for). I am trying to figure out the portable way of doing this (Paul just showed me something I think can work). Second -- registration is a specialization, and so has to be done out of global namespace (to get into the required namespace). This is also inconvenient.
For what do you need the unique integer (i.e., what does it buy you)? Will it be used as an integral constant template parameter, or as a key during runtime, or what?
Integral constant. Each class/template can be assigned a unique integer constant, so that the whole class (template tree) can be encoded into an mpl::vector_c (or similar), to be later decoded into the original type. Everything is done at compile time (as you would expect with typeof). Regards, Arkadiy