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
.
More 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::shared_ptr initialization: make_shared() vs shared_ptr(new Foo) [duplicate]
- Passing shared_ptr as shared_ptr
- Where is shared_ptr?
- Should I delete the move constructor and the move assignment of a smart pointer?
- std::auto_ptr to std::unique_ptr
- Why is auto_ptr being deprecated?
- unique_ptr and OpenSSL’s STACK_OF(X509)*
- Why would I std::move an std::shared_ptr?
- C++11: Replace all non-owning raw pointers with std::shared_ptr()?
- C++11 reverse range-based for-loop
- Why is the C++ initializer_list behavior for std::vector and std::array different?
- static_assert fails compilation even though template function is called nowhere
- Initializing a member array in constructor initializer
- decltype and parentheses
- Visual Studio 2012 __cplusplus and C++ 11
- How do I properly use std::string on UTF-8 in C++?
- Range-based for loop on a dynamic array?
- std::remove_if – lambda, not removing anything from the collection
- C++11 variable number of arguments, same specific type
- gcc can compile a variadic template while clang cannot
- ISO C++ standard draft
- memcpy/memmove to a union member, does this set the ‘active’ member?