cppannotations/yo/stl/sharedptr.yo
2009-07-16 10:04:57 +00:00

12 lines
542 B
Text

In addition to tt(std::unique_ptr) the C++0x standard offers a reference
counting smart pointer by the name of ti(std::shared_ptr<Type>).
The shared pointer will automatically destroy its contents once its reference
count has decayed to zero.
Different from tt(unique_ptr)s tt(shared_ptr)s support copy constructors and
standard overloaded assignment operators. Since tt(shared_ptr)s share the
memory they point at i(move semantics) is not a requirement.
As with tt(unique_ptr) a tt(shared_ptr) may refer to a dynamically allocated
array.