Difference between revisions of "Template:cpp/container/destructor"
From cppreference.com
m (1 revision: import content) |
m (Added "triviality" note for `inplace_vector`.) |
||
(18 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{#vardefine:cont|{{{1|inplace_vector}}}}}<!-- |
− | {{cpp/container/{{ | + | -->{{cpp/container/{{#var:cont}}/title|~{{#var:cont}}}} |
− | {{ddcl | | + | {{cpp/container/{{#var:cont}}/navbar}} |
− | + | {{ddcl|since={{cpp/std|{{#var:cont}}}}|notes={{#ifeq:{{#var:cont}}|vector|{{mark constexpr since c++20}}}}| | |
+ | {{#switch:{{#var:cont}}|inplace_vector=constexpr ~|~}}{{#var:cont}}(); | ||
}} | }} | ||
− | {{cpp/ | + | A {{lt|cpp/language/destructor}}. {{#switch:{{#var:cont}}|inplace_vector=Also, a {{lsd|cpp/language/destructor#Trivial destructor}} if {{c|std::is_trivially_destructible_v<T>}} is {{c|true}}.}} |
− | | | + | <!----> |
− | + | Destructs the {{tt|{{#var:cont}}}}. The destructors of the elements are called and the used storage is deallocated. Note, that if the elements are pointers, the pointed-to objects are not destroyed. | |
− | }} The destructors of the elements are called and the used storage is deallocated. | + | |
− | + | ===Complexity=== | |
− | {{ | + | Linear in the size of the {{tt|{{#var:cont}}}}. |
− | + | ||
− | + | ||
− | + | ||
− | + |
Latest revision as of 03:50, 4 September 2024
constexpr ~inplace_vector(); |
(since C++26) | |
A destructor. Also, a trivial destructor if std::is_trivially_destructible_v<T> is true.
Destructs the inplace_vector
. The destructors of the elements are called and the used storage is deallocated. Note, that if the elements are pointers, the pointed-to objects are not destroyed.
[edit] Complexity
Linear in the size of the inplace_vector
.