
"Arkadiy Vertleyb" <vertleyb@hotmail.com> writes:
"David Abrahams" <dave@boost-consulting.com> wrote
"Arkadiy Vertleyb" <vertleyb@hotmail.com> writes:
- Whenever the user needs to register her own classes, she provides identifiers by any means she prefers, such as enum, etc., starting from BOOST_TYPEOF_USER_GROUP.
How will multiple independent users, or libraries that use boost, avoid collisions?
If the class is registered in a header, it should be registered against a symbol somehow produced from the name of this header (in the similar way to include guards). If the author of such classes wants to be independent, she supplies a separate header, where her symbols are enumerated, looking somehing like:
enum { MY_SYMBOL_1 = BOOST_TYPEOF_LAST, MY_SYMBOL_2, ... MY_SYMBOL_LAST }; #undef BOOST_TYPEOF_LAST #define BOOST_TYPEOF_LAST MY_SYMBOL_LAST
ultimately, at some point, somebody is writing a CPP file. This end user has to collect all such headers, and "chain" them in a single header, thus emulating a single enum.
That sounds like a serious usability problem to me. Furthermore, we'll still have an ODR violation if two separately-compiled libraries do the chaining in different ways. Am I wrong? -- Dave Abrahams Boost Consulting http://www.boost-consulting.com