23 #ifndef NDARRAY_Manager_h_INCLUDED
24 #define NDARRAY_Manager_h_INCLUDED
33 #include <boost/noncopyable.hpp>
34 #include <boost/intrusive_ptr.hpp>
35 #include <boost/scoped_array.hpp>
39 class Manager :
private boost::noncopyable {
42 typedef boost::intrusive_ptr<Manager>
Ptr;
49 if ((--manager->
_rc)==0)
delete manager;
54 virtual bool isUnique()
const {
return false; }
68 typedef typename boost::remove_const<T>::type
U;
71 static std::pair<Manager::Ptr,T*>
allocate(
int size) {
72 boost::intrusive_ptr<SimpleManager> r(
new SimpleManager(size));
73 return std::pair<Manager::Ptr,T*>(r, r->_p.get());
80 if (size > 0)
_p.reset(
new U[size]);
82 boost::scoped_array<U>
_p;
100 template <
typename T>
112 #endif // !NDARRAY_Manager_h_INCLUDED
virtual bool isUnique() const
friend void intrusive_ptr_release(Manager const *manager)
Forward declarations and default template parameters for ndarray.
boost::scoped_array< U > _p
boost::intrusive_ptr< Manager > Ptr
boost::remove_const< T >::type U
friend Manager::Ptr makeManager(T const &owner)
friend void intrusive_ptr_add_ref(Manager const *manager)
virtual bool isUnique() const
Owner const & getOwner() const
static std::pair< Manager::Ptr, T * > allocate(int size)
ExternalManager(Owner const &owner)
Manager::Ptr makeManager(T const &owner)