
On 4/5/07, Matthias Schabel <boost@schabel-family.org> wrote:
http://thread.gmane.org/gmane.comp.lib.boost.devel/101946/focus=102070
Would that be enough? Usage would look like:
#include BOOST_UNITS_ORDINAL_GENERATOR() struct my_unit : ordinal<BOOST_UNITS_NEXT_ORDINAL> { };
I believe the problem with this is that it doesn't guarantee uniqueness across translation units; Steven understands these issues better than I do, though.
I think that problem only arises if you actually define units in a source file instead of a header file. That shortcoming could just be documented, since it seems pretty rare that someone would define their custom unit in a source file instead of a header. If they really wanted to do that, they could still just use the current method. A quick test with VC8.0 just now shows that even __COUNTER__ has that problem when used in source files, but in headers Paul M.'s method works just fine. --Michael Fawcett