Index: shared_array.hpp =================================================================== --- shared_array.hpp (revision 52581) +++ shared_array.hpp (working copy) @@ -35,6 +35,40 @@ namespace boost { +namespace detail +{ + template struct sa_wrap {}; + + //is T a const-qualified version of Y? + template< class T, class Y > struct is_const_version_impl + { + typedef char (&yes) [1]; + typedef char (&no) [2]; + + static yes f( const sa_wrap& ); + static no f( ... ); + + enum _vt { value = sizeof( f( sa_wrap() ) ) == sizeof(yes) }; + }; + + struct sa_empty {}; + + template struct sa_is_const; + + template <> struct sa_is_const + { + typedef sa_empty type; + }; + + template <> struct sa_is_const + {}; + + template + struct sa_enable + : public sa_is_const::value> + {}; +} + // // shared_array // @@ -69,8 +103,15 @@ { } -// generated copy constructor, assignment, destructor are fine +// generated assignment, destructor are fine + template + shared_array(shared_array const & other, + typename detail::sa_enable::type = detail::sa_empty()) // never throws + : px(other.px), + pn(other.pn) + {} + void reset(T * p = 0) { BOOST_ASSERT(p == 0 || p != px); @@ -115,6 +156,8 @@ private: + template friend class shared_array; + T * px; // contained pointer detail::shared_count pn; // reference counter