New standard for C++, namely “C++0x”, is introducing a new smart pointer type: std::unique_ptr. GCC (and probably other C++ compilers too) supports it already. But unfortunately it’s hard to find good documentation for std::unique_ptr in the Internet. What is important about that:
- std::unique_ptr type is available in header <memory>
- Use it instead of std::auto_ptr which is deprecated now (AFAIK) – in general std::unique_ptr is replacement for std:auto_ptr.
- Motivation to use: simpler (less memory footprint? faster?) smart pointer when you don’t need something more sophisticated like boost::shared_ptr