It will call delete[]
and hence the entire array will be reclaimed but I believe you need to indicate that you are using an array form of unique_ptr
by:
std::unique_ptr<int[]> my_array(new int[5]);
This is called as Partial Specialization of the unique_ptr
.
Related Contents:
- What is a smart pointer and when should I use one?
- Which kind of pointer do I use when?
- Why can I not push_back a unique_ptr into a vector?
- Differences between std::make_unique and std::unique_ptr with new
- Is there any use for unique_ptr with array?
- “Downcasting” unique_ptr to unique_ptr
- How much is the overhead of smart pointers compared to normal pointers in C++?
- Is there a non-atomic equivalent of std::shared_ptr? And why isn’t there one in ?
- std::auto_ptr to std::unique_ptr
- Should I delete the move constructor and the move assignment of a smart pointer?
- Passing shared_ptr as shared_ptr
- Where is shared_ptr?
- What are Aggregates and PODs and how/why are they special?
- C++11 rvalues and move semantics confusion (return statement)
- C++ template typedef
- Are there any valid use cases to use new and delete, raw pointers or c-style arrays with modern C++?
- Rvalue Reference is Treated as an Lvalue?
- SFINAE working in return type but not as template parameter
- Sequence-zip function for c++11?
- How do I use a custom deleter with a std::unique_ptr member?
- How can I sort two vectors in the same way, with criteria that uses only one of the vectors?
- Why is conversion from string constant to ‘char*’ valid in C but invalid in C++
- What is the type of lambda when deduced with “auto” in C++11?
- How do I combine hash values in C++0x?
- Copy constructor for a class with unique_ptr
- Why do std::shared_ptr work
- std::next_permutation Implementation Explanation
- C++11 features in Visual Studio 2012
- How to use range-based for() loop with std::map?
- How to initialize std::array elegantly if T is not default constructible?
- lifetime of a std::initializer_list return value
- Disambiguate class-member in multiple inheritance
- Range-for-loops and std::vector
- Passing arguments to std::async by reference fails
- Why can I not brace initialize a struct derived from another struct?
- Is there a range class in C++11 for use with range based for loops?
- Can C++ code be valid in both C++03 and C++11 but do different things?
- What do each memory_order mean?
- How do compilers treat variable length arrays
- What is decltype with two arguments?
- C++11 static_assert and template instantiation
- Cannot create constexpr std::vector
- In C++, is it still bad practice to return a vector from a function?
- Template specialization and enable_if problems [duplicate]
- Can I typically/always use std::forward instead of std::move?
- Why should I use std::async?
- Enum vs Strongly typed enum
- Configuring the GCC compiler switches in Qt, QtCreator, and QMake
- How can I use std::imbue to set the locale for std::wcout?
- unique_ptr boost equivalent?