|
Boost : |
From: Jeff King (peff-boost_at_[hidden])
Date: 2001-11-17 02:07:42
On Fri, 16 Nov 2001, ERICSSON,JOHAN (A-Sonoma,ex1) wrote:
> I don't think that non-default constructable elements are any more difficult
> to use with standard containers.
<nod> I think I was acting out of an irrational desire to make them more
like primitive types on principle. In retrospect, it probably is a
better idea to favor value semantics rather than acting like a raw
pointer (since the point of the class is to have value semantics :) ).
> My only qualm would be that I would prefer that it didn't have a default
> constructor, for the same reasons as I mentioned for poly_ptr. Its no fun
> having to do "if (p.get()) p->DoSomething()" all over the place.
You can always wrap it in a nonnull_ptr class which masked the default
constructor. That's just off the top of my head; I'm not sure how
feasible such a thing would be.
-Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk