Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2004-11-17 17:58:42


On 11/9/04 7:42 PM, "Joe Gottman" <jgottman_at_[hidden]> wrote:

> I used base_from_member today for the first time. It got me out of a
> sticky situation, but I think it could use a few modifications. Since it is
> designed to be used as a base class but does not have any virtual functions,
> the copy constructor, assignment operator, and destructor should all be
> protected.

Explicitly adding copying methods prevents BFM from being used with
non-copy-able types. The implicit versions, including the possibility that
they would be disabled, work just fine. The opportunities for abuse having
those three methods public would have to involve the user not using the
template as intended and then deliberately setting up a dangerous situation.
(Why would you have a BFM pointer [to use for an inappropriate deletion] in
the first place? BFM has no functionality besides its set-up duties.)

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

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