Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2001-09-02 12:22:10


on 9/1/01 8:17 PM, Bill Kempf at williamkempf_at_[hidden] wrote:

> --- In boost_at_y..., "Peter Dimov" <pdimov_at_m...> wrote:
>> From: "William Kempf" <williamkempf_at_h...>
>>> From: "Peter Dimov" <pdimov_at_m...>
[SNIP]
>>>> The reference for many classes indicates that they derive from
>>>> boost::noncopyable. This implies, AFAICS, that a C-style cast to
>>>> boost::noncopyable* works. If retained, all such derivations need an
>>>> 'exposition-only' comment.
>>>
>>> They indicate private derivation, so the cast isn't valid. So I'm not sure
>>> the comment is needed, but I'm happy to add it.
>>
>> The C-style cast is, unfortunately, valid, even when the base class is
>> inaccessible. (5.4/7)
>
> Hmmm... ugly. Can't say as I understand the reasoning for this. In any
> event, the whole point of boost::noncopyable is to be used in private
> derivation in this manner, so I wouldn't expect much confusion with things as
> they are now. I will, however, add the comment.
[TRUNCATE]

I haven't looked at the Threads library yet. If you want to say that a
class is non-copyable in the documentation, then say that directly instead
of saying that the class derives from boost::noncopyable. Use of
boost::noncopyable is an implementation detail, and mentioning it may make
some users try to take advantage of that inheritance.

Also, just saying that a class inherits from boost::noncopyable assumes that
the user fully knows about Boost culture, at least about the
boost::noncopyable class. New users would have no idea what that
inheritance implies unless they look up boost::noncopyable.

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

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