This rule is Obsolete | |
Synopsis: | Use smart pointers from the standard library |
Language: | C++ |
Severity Level: | 4 |
Category: | Object Allocation |
Description: |
The boost C++ libraries introduced the concept of smart pointers some while ago. The big advantage of smart pointers is that they minimize potential memory leaks. As a result, the boost smart pointers became very popular and thus were adopted by the standard C++ library "std" as well. This rule promotes the use of the "std" variants of smart pointers as opposed to e.g. boost smart pointers because the "std" smart pointers are the standard now. Incorrect example: boost::shared_ptr Correct example: std::shared_ptr |