--- Gregory Colvin <[EMAIL PROTECTED]> wrote:How will I even know it, the documentation is completely ignorant on the memory issues.
Perhaps because you work with the authors of the documentation to make it sure it says what needs saying?
Are the documentation authors monitoring this mailing list?
And I have no objection myself to adding an allocator parameter to the shared_ptr constructor, or to making some other change that serves the purpose. So if you need a change, why not just do it, try it out, and submit a patch?
How about
template< typename T, typename Counter = int > shared_ptr { typedef Counter counter; //counter type should be public
template <typename DataAlloc = std::allocator<T>, typename CounterAlloc=std::allocator<counter>shared_ptr( const DataAlloc& da = DataAlloc(), const IntAlloc ia& = CountAlloc() );
};
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.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost