Difference between revisions of "cpp/string/basic string/clear"
From cppreference.com
< cpp | string | basic string
(use rev to mark the changes between standards) |
(don't use ddcl) |
||
Line 1: | Line 1: | ||
{{cpp/string/basic_string/title | clear}} | {{cpp/string/basic_string/title | clear}} | ||
{{cpp/string/basic_string/navbar}} | {{cpp/string/basic_string/navbar}} | ||
− | {{ | + | {{dcl begin}} |
+ | {{dcl | | ||
void clear(); | void clear(); | ||
}} | }} | ||
+ | {{dcl end}} | ||
Removes all characters from the string. The allocated memory will not be released, effectively leaving the {{lc|capacity}} of the string unchanged. The past-the-end iterators are not invalidated. | Removes all characters from the string. The allocated memory will not be released, effectively leaving the {{lc|capacity}} of the string unchanged. The past-the-end iterators are not invalidated. |
Revision as of 03:54, 25 June 2013
void clear(); |
||
Removes all characters from the string. The allocated memory will not be released, effectively leaving the capacity of the string unchanged. The past-the-end iterators are not invalidated.
Contents |
Parameters
(none)
Return value
(none)
Exceptions
(none) | (until C++11) |
noexcept specification: noexcept |
(since C++11) |
Complexity
Linear in the size of the string.
See also
removes characters (public member function) |