Top "Unique-ptr" questions

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

How to pass const pointer to const object using unique_ptr

I want to pass a unique_ptr to a helper function, and I want to make sure that the helper …

c++ c++11 unique-ptr
unique_ptr & vector, trying to access deleted function, Visual Studio 2013

I am trying to use unique_ptr to manage my memory, and VS2013 seems to be giving me trouble when …

c++ visual-c++ visual-studio-2013 unique-ptr oglplus
Bad practice to return unique_ptr for raw pointer like ownership semantics?

I've written a static factory method that returns a new Foobar object populated from another data object. I've recently been …

c++ smart-pointers unique-ptr ownership-semantics
So can unique_ptr be used safely in stl collections?

I am confused with unique_ptr and rvalue move philosophy. Let's say we have two collections: std::vector<std::…

c++ c++11 auto-ptr unique-ptr
C++ unique_ptr and map

I'm trying to use the C++0x unique_ptr class inside a map like so: // compile with `g++ main.cpp …

c++ gcc c++11 stl unique-ptr
How do I pass smart pointers into functions?

When passing objects into functions, do the same rules apply to smart pointers as to other objects that contain dynamic …

c++ c++11 parameter-passing smart-pointers unique-ptr
How can I compile C++11 code with Orwell Dev-C++?

Trying to compile the following code: #include <iostream> #include <memory> struct Foo { Foo() { std::cout <&…

c++ c++11 unique-ptr dev-c++
How do I use unique_ptr for pimpl?

Here is a simplification of what I'm seeing when I try to use unique_ptr for pimpl. I chose unique_…

c++ c++11 pimpl-idiom unique-ptr
Should I use shared_ptr or unique_ptr

I've been making some objects using the pimpl idiom, but I'm not sure whether to use std::shared_ptr or …

c++ c++11 shared-ptr pimpl-idiom unique-ptr
Is unique_ptr thread safe?

Is unique_ptr thread safe? Is it impossible for the code below to print same number twice? #include <memory&…

c++ multithreading c++11 thread-safety unique-ptr