#include "boost/shared_array.hpp" #include struct B {}; struct D : public B {}; int main() { #if 1 boost::shared_array pInt(new int[50]); boost::shared_array pIntConst1(pInt); boost::shared_array pInt2; pInt2 = pInt; boost::shared_array pIntConst2(pIntConst1); boost::shared_array pIntConst3; pIntConst3 = pIntConst1; std::cout << "Use count: " << pInt.use_count() << std::endl; boost::shared_array pD(new D[50]); boost::shared_array pD2(pD); std::cout << "Use count: " << pD2.use_count() << std::endl; #else boost::shared_array pD(new D[50]); boost::shared_array pB(pD); #endif return 0; }