|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-05-03 10:20:49
"Arkadiy Vertleyb" <vertleyb_at_[hidden]> writes:
> "David Abrahams" <dave_at_[hidden]> wrote
>
>> > The provided example shows what registration needs to be done to
> calculate
>> > the type of a lambda functor:
>> >
>> > #include BOOST_TYPEOF_BEGIN_REGISTRATION()
>>
>> Where would that line go, in a header file?
>>
>> > BOOST_TYPEOF_REGISTER_TEMPLATE(tuples::tuple, 2);
>> > BOOST_TYPEOF_REGISTER_TEMPLATE(lambda_functor, 1);
>> > ....
>> > BOOST_TYPEOF_REGISTER_TYPE(placeholder<2>);
>> >
>> > #include BOOST_TYPEOF_END_REGISTRATION()
>>
>> Where would that line go, in a source file? If so, that sounds
>> error-prone to me.
>
> Everything would go into one file -- source or header.
>
> The BEGIN_REGISTRATION establishes a unique REGISTRATION_GROUP (using the
> counter suggested by Paul Mensonides). The REGISTRATION_GROUP is then used
> by the registration macros in conjunction with __LINE__ to generate unique
> integer identifiers. The END_REGISTRATION is technicaly not necessary. It
> just undefs the REGISTRATION_GROUP to force other files use the
> BEGIN_REGISTRATION (and so avoid potential clashes).
So does it work if multiple headers using
BEGIN_REGISTRATION/END_REGISTRATION are included?
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk