Namespaces
Variants
Views
Actions

Difference between revisions of "Template:cpp/container/clear"

From cppreference.com
(use {{dcl rev begin/end}}, use since= parameter)
(I believe this is implementation-specific.)
Line 5: Line 5:
 
}}
 
}}
  
Removes all elements from the container. {{#ifeq: {{{1|}}} | vector | The allocated memory will not be released, effectively leaving the {{rlpt|capacity}} of the vector unchanged.}} The past-the-end iterators are not invalidated.
+
Removes all elements from the container. Any past-the-end iterators are not invalidated. {{#ifeq: {{{1|}}} | vector | Many implementations will not release allocated memory after a call to {{tt|clear()}}, effectively leaving the {{rlpt|capacity}} of the vector unchanged.}}
  
 
===Parameters===
 
===Parameters===

Revision as of 15:07, 24 June 2013

void clear();

Removes all elements from the container. Any 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.


See also

erases elements
(public member function of std::{{{1}}}) [edit]