--- Gregory Colvin <[EMAIL PROTECTED]> wrote:
> 
> shared_ptr doesn't allocate the data, it only deletes it, which is the  
> job of the
> current deleter parameter.  And the counter type is by design not part  
> of the
> shared_ptr type, so it doesn't belong as parameter to the shared_ptr  
> template.
> See:
>      
> http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/boost/boost/boost/ 
> shared_ptr.hpp
> 
> So you what you might want is to add something more like this to  
> shared_ptr:
> 
>     template<typename Data, typename Deleter, template<class Counter>  
> class Allocator>
>     shared_ptr(
>        Data*,
>        Deleter,
>        const Allocator<boost::detail::sp_counted_base_impl<Data*,  
> Deleter> >& );
> 
> The idea being that you can use this constructor to get complete  
> control over how
> a particular shared_ptr manages memory.

In this solution, there are some issues with who 
controls the instances of the allocator that allocates
Data and instances that delete the Data.
But I guess it is not big deal as soon as 
people understand it.

If are to use template template parameters,
it would be nice to be able to define one allocator 
type for both counter and data.

    template<typename Data, template<class>  
class Allocator>
    shared_ptr(
       Data*,
       Allocator<Data>,
       const Allocator<boost::detail::sp_counted_base_impl<Data*,  
Deleter> >& );

Eugene


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to