#includeusing namespace boost; int main() { shared_ptr ptr(new int(10)); return 0; }
#includeusing namespace boost; int main() { shared_ptr ptr(new int(10)); shared_ptr ptr2 = ptr; return 0; }
#includeThese examples are from the Boost C++ libraries, which are a collection of libraries for C++ programming. The shared_ptr class is part of the Boost Smart Pointers library, which provides several types of smart pointers for automatic memory management.using namespace boost; int main() { shared_ptr ptr(new int(10)); ptr.reset(new int(20)); return 0; }