Boost logo

Boost Users :

From: bjorn.karlsson_at_[hidden]
Date: 2002-04-30 02:41:28


> From: Jim Hyslop [mailto:jim.hyslop_at_[hidden]]
>
> I notice that the implementation available at boost.org does not allow
> the single-argument ctor to be called on an incomplete type, e.g.:
[snip]
> The documentation on the single-argument ctor, though, does not state
> that T must be a complete type. Is the implementation
> stricter than the
> documentation, or is the documentation incomplete?

I believe that the implementation is correct, and that belief is confirmed
by the latest documentation in the CVS - T must indeed be a complete type.
Another change is the addition of a default constructor, which does not
require T to be complete.
 
> I'm writing an article on the smart pointers for the CUJ, and I'd like

Cool! ;-)

> to know if I can correctly state "The default behavior for
> shared_ptr is
> to require complete types. You can, however, manage an incomplete type
> if you provide a function or function object, which will be
> called when
> the owned object is destroyed."

Since shared_ptr requires a complete type only for a few operations, such as
the constructor that you mentioned, and reset(T * p), I'd rephrase to
something more explicit, like:
"The instantiation of a shared_ptr typically requires a complete type.
[etc]".

Bjorn Karlsson

[Non-text portions of this message have been removed]


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net