Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-03-03 18:08:46


JOAQUIN LOPEZ MU?Z wrote:
> De: Jonathan Turkanis

>> I'd like to suggest two macros which would allow code like the
>> above to be
>> simplified as follows:
>>
>> BOOST_PRIVATE:
>> BOOST_BEFRIEND_TEMPLATE(shared_ptr, Y, 1)
>> BOOST_BEFRIEND_TEMPLATE(weak_ptr, Y, 1)
>>
>> T * px; // contained pointer
>> detail::shared_count pn; // reference counter
>>
>
> BOOST_PRIVATE seems a little to uninformative a name to me.

I like it because if you ignore the BOOST_ (and the case) the code looks like it
would on a conforming compiler -- you can forget about what happens on a broken
compiler.

> The macros I'm using are:

> BOOST_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS
> BOOST_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS

These would be okay with me. But sometimes I use a macro for specifying the type
of derivation, and

    struct derived_class
        : BOOST_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS base_class
    { };

seems a bit long.

> (well, I'm using lib-specific variations of these names,
> but you get the idea.)
>
> As for your proposal, I like it: there are at least three
> libraries that would benefit from it.

Thanks.

> Joaquín M López Muñoz

Jonathan


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