Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/string/basic string/clear"

From cppreference.com
< cpp‎ | string‎ | basic string
m (§ 21.4.4 of N3485)
(use rev to mark the changes between standards)
Line 14: Line 14:
  
 
===Exceptions===
 
===Exceptions===
{{noexcept}}
+
{{rev begin}}
 +
{{rev | until=c++11 | (none) }}
 +
{{rev | since=c++11 | {{noexcept}} }}
 +
{{rev end}}
  
 
===Complexity===
 
===Complexity===

Revision as of 03:54, 25 June 2013

 
 
 
std::basic_string
Member functions
Element access
Iterators
Capacity
Modifiers
basic_string::clear
Search
Operations
Constants
Non-member functions
I/O
Comparison
(until C++20)(until C++20)(until C++20)(until C++20)(until C++20)(C++20)
Numeric conversions
(C++11)(C++11)(C++11)
(C++11)(C++11)
(C++11)(C++11)(C++11)
(C++11)
(C++11)
Literals
Helper classes
Deduction guides (C++17)

 
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) [edit]