Difference between revisions of "Template:cpp/container/clear"
From cppreference.com
(added note about complexity) |
(it's directly defined to be linear for associative containers (table 102 in 23.2.4[associative.reqmts]) |
||
Line 18: | Line 18: | ||
===Complexity=== | ===Complexity=== | ||
linear in the size of the container. | linear in the size of the container. | ||
− | + | {{cpp/container/if seq|{{{1|}}}| | |
{{rev list begin}} | {{rev list begin}} | ||
{{rev list item | | {{rev list item | | ||
Line 26: | Line 26: | ||
{{tt|clear}} is not defined in terms of {{tt|erase}}, but [http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#2231 LWG 2231] proposes to define {{tt|clear}} to have linear complexity for sequence containers. | {{tt|clear}} is not defined in terms of {{tt|erase}}, but [http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#2231 LWG 2231] proposes to define {{tt|clear}} to have linear complexity for sequence containers. | ||
| {{mark since c++11}} }} | | {{mark since c++11}} }} | ||
− | {{rev list end}} | + | {{rev list end}} }} |
===See also=== | ===See also=== |
Revision as of 08:54, 21 February 2013
void clear(); |
||
Removes all elements from the container. The past-the-end iterators are not invalidated.
Contents |
Parameters
(none)
Return value
(none)
Exceptions
noexcept specification:
noexcept
Complexity
linear in the size of the container.