Where is shared_ptr?

前端 未结 4 967
甜味超标
甜味超标 2020-11-29 19:56

I am so frustrated right now after several hours trying to find where shared_ptr is located. None of the examples I see show complete code to include the headers for s

4条回答
  •  一生所求
    2020-11-29 20:41

    There are at least three places where you may find shared_ptr:

    1. If your C++ implementation supports C++11 (or at least the C++11 shared_ptr), then std::shared_ptr will be defined in .

    2. If your C++ implementation supports the C++ TR1 library extensions, then std::tr1::shared_ptr will likely be in (Microsoft Visual C++) or (g++'s libstdc++). Boost also provides a TR1 implementation that you can use.

    3. Otherwise, you can obtain the Boost libraries and use boost::shared_ptr, which can be found in .

提交回复
热议问题