Top "Unique-ptr" questions

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

Differences between unique_ptr and shared_ptr

Possible Duplicates: pimpl: shared_ptr or unique_ptr smart pointers (boost) explained Could someone explain differences between shared_ptr and …

c++ pointers c++11 shared-ptr unique-ptr
How do I pass a unique_ptr argument to a constructor or a function?

I'm new to move semantics in C++11 and I don't know very well how to handle unique_ptr parameters in …

c++ arguments c++11 unique-ptr
Returning unique_ptr from functions

unique_ptr<T> does not allow copy construction, instead it supports move semantics. Yet, I can return a …

c++ c++11 unique-ptr
Is there any use for unique_ptr with array?

std::unique_ptr has support for arrays, for instance: std::unique_ptr<int[]> p(new int[10]); but is …

c++ c++11 smart-pointers unique-ptr
Why can I not push_back a unique_ptr into a vector?

What is wrong with this program? #include <memory> #include <vector> int main() { std::vector<std::…

c++ stl c++11 smart-pointers unique-ptr
How to declare std::unique_ptr and what is the use of it?

I try to understand how std::unique_ptr works and for that I found this document. The author starts from …

c++ pointers std unique-ptr
How do I use a custom deleter with a std::unique_ptr member?

I have a class with a unique_ptr member. class Foo { private: std::unique_ptr<Bar> bar; ... }; The …

c++ c++11 move-semantics unique-ptr
error::make_unique is not a member of ‘std’

I am trying to compile the following thread pool program posted on code review to test it. https://codereview.stackexchange.…

c++ c++11 compiler-errors c++14 unique-ptr
Using smart pointers for class members

I'm having trouble understanding the usage of smart pointers as class members in C++11. I have read a lot about …

c++ c++11 shared-ptr smart-pointers unique-ptr
Advantages of using std::make_unique over new operator

What are the advantages of using std::make_unique over the new operator for initializing a std::unique_ptr? In …

c++ c++14 unique-ptr