Which header should be used to use scoped_ptr

I want to use a smart pointer in my C ++ application.

What header file should I specify to use std scoped_ptr?

+5
source share
3 answers

There is no scoped_ptr in the C ++ standard library. All C ++ 11 smart pointers are in the header <memory>. If you want boost :: scoped_ptr , you need to boost/scoped_ptr.hpp.

+6
source

There is stdno namespace scoped_ptr.
You can use boost::scoped_ptrfrom boost .
Or, I think you would like std::unique_ptr. In this case you need to enable<memory>

+3

scoped_ptris part of the Boost library , not the standard library.

+2
source

All Articles