Top "Unique-ptr" questions

std::unique_ptr is a smart pointer that retains sole ownership of an object through a pointer.

Differences between std::make_unique and std::unique_ptr with new

Does std::make_unique have any efficiency benefits like std::make_shared? Compared to manually constructing std::unique_ptr: std::…

c++ c++11 c++14 smart-pointers unique-ptr
How to pass std::unique_ptr around?

I am having my first attempt at using C++11 unique_ptr; I am replacing a polymorphic raw pointer inside a …

c++ c++11 unique-ptr
std::unique_ptr with an incomplete type won't compile

I'm using the pimpl-idiom with std::unique_ptr: class window { window(const rectangle& rect); private: class window_impl; // defined …

c++ unique-ptr incomplete-type libc++
error: ‘unique_ptr’ is not a member of ‘std’

I guess it's pretty self explanatory - I can't seem to use C++11 features, even though I think I have …

c++ c++11 g++ unique-ptr
Should I assign or reset a unique_ptr?

Given the common situation where the lifespan of an owned object is linked to its owner, I can use a …

c++ c++11 smart-pointers unique-ptr
std::unique_ptr usage

std::unique_ptr<int> p1(new int); std::unique_ptr<int> p2(new int); p2=p1; …

c++ c++11 unique-ptr
What happens to unique_ptr after std::move()?

This code is what I want to do: Tony& Movie::addTony() { Tony *newTony = new Tony; std::unique_ptr<…

c++ unique-ptr
Is std::unique_ptr<T> required to know the full definition of T?

I have some code in a header that looks like this: #include <memory> class Thing; class MyClass { std::…

c++ visual-studio-2010 c++11 stl unique-ptr
Is auto_ptr deprecated?

Will auto_ptr be deprecated in incoming C++ standard? Should unique_ptr be used for ownership transfer instead of shared_…

c++ standards smart-pointers auto-ptr unique-ptr
How to implement make_unique function in C++11?

My compiler doesn't support make_unique. How to write one? template< class T, class... Args > unique_ptr<…

c++ c++11 unique-ptr c++14