Boost logo

Boost :

From: E. Gladyshev (egladysh_at_[hidden])
Date: 2003-08-29 16:14:12


--- Gregory Colvin <gregory.colvin_at_[hidden]> wrote:

> Bullshit:
>
> template<class Y, class D> shared_ptr(Y * p, D d);
>
> Requirements: p must be convertible to T *. D must be
> CopyConstructible. The copy constructor and destructor of D
> must not throw. The expression d(p) must be well-formed, must
> not invoke undefined behavior, and must not throw exceptions.
>
> Effects: Constructs a shared_ptr that owns the pointer p and
> the deleter d.
>
> Postconditions: use_count() == 1 && get() == p .
>
> Throws: std::bad_alloc or an implementation-defined exception
> when a resource other than memory could not be obtained.
>
> Exception safety: If an exception is thrown, d(p) is called.
>
> Notes: When the time comes to delete the object pointed to by p,
> the stored copy of d is invoked with the stored copy of p as an
> argument.
>
> http://www.boost.org/libs/smart_ptr/shared_ptr.htm#constructors

Well said. :) Sorry about that.

I looked at the "Common Requirements" section
and description of shared_ptr::reset();

-
template<class Y, class D> void reset(Y * p, D d);
Effects: Equivalent to shared_ptr(p, d).swap(*this).
-

Somehow I missed the constructor docs.
Sorry again.

Anyway like I said before several times
it is not a big deal in my opinion.
People are adopted to follow similar
requirements for STL allocators anyway.

I guess they can be recommended to all boost
authors who wants to make memory management
data types.

Perhaps they can be added to the "Guidlines" section
http://www.boost.org/more/lib_guide.htm#Guidelines

Eugene

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


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