std::unique_ptr is a smart pointer that retains sole ownership of an object through a pointer.
In the code below, I made p const because it will never point to any other int during Foo's lifetime. …
c++ constants move unique-ptr move-constructorWhat are the equivalent uses of each smart pointer in comparison to similar (but not limited to) some advanced techniques …
c++ shared-ptr unique-ptr auto-ptr weak-ptrAs far as I understand, C++14 introduced std::make_unique because, as a result of the parameter evaluation order not …
c++ c++17 unique-ptrThis is a very simple question. Consider the following code: #include <iostream> #include <memory> typedef std::…
c++ visual-studio-2010 gcc c++11 unique-ptrNow first, I am aware of the general issues with unique_ptr<> and forward declarations as in Forward …
c++ c++11 unique-ptr forward-declarationUsing C++11, let's say I have factory functions dealing with base and derived classes: #include <memory> using namespace …
c++ c++11 unique-ptr c++14As a follow up to this post I wonder how its implementation of make_unique plays with allocating function-temporary buffer …
c++ arrays c++11 unique-ptr raiiI'd like to move the unique_ptr's stored in an unsorted vector of them to another vector, that will contain …
c++ c++11 move-semantics unique-ptrBased on the answers in these questions here, I know that it is certainly preferred to use c++14's std::…
c++ c++11 stdvector c++14 unique-ptrRaw pointers can point to objects allocated on the stack or on the heap. Heap allocation example: // heap allocation int* …
c++11 pointers smart-pointers heap-memory unique-ptr