Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-07-22 10:01:51


"David Abrahams" <dave_at_[hidden]> wrote

> "Arkadiy Vertleyb" <vertleyb_at_[hidden]> 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.

Arkadiy


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