Namespaces
Variants
Views
Actions

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

From cppreference.com
< cpp‎ | string‎ | basic string
(Missed template parameter Traits)
m (match C++14 wording tweak s/calls/equivalent/)
Line 8: Line 8:
 
{{dcl end}}
 
{{dcl end}}
  
Specializes the {{lc|std::swap}} algorithm for {{lc|std::basic_string}}. Swaps the contents of {{tt|lhs}} and {{tt|rhs}}. Calls {{c|lhs.swap(rhs)}}.
+
Specializes the {{lc|std::swap}} algorithm for {{lc|std::basic_string}}. Swaps the contents of {{tt|lhs}} and {{tt|rhs}}. Equivalent to {{c|lhs.swap(rhs)}}.
  
 
===Parameters===
 
===Parameters===

Revision as of 19:57, 19 March 2014

 
 
 
std::basic_string
Member functions
Element access
Iterators
Capacity
Modifiers
Search
Operations
Constants
Non-member functions
swap(std::basic_string)
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)

 
template< class T, class Traits, class Alloc >
void swap( basic_string<T, Traits, Alloc> &lhs, basic_string<T, Traits, Alloc> &rhs );

Specializes the std::swap algorithm for std::basic_string. Swaps the contents of lhs and rhs. Equivalent to lhs.swap(rhs).

Contents

Parameters

lhs, rhs - strings whose contents to swap

Return value

(none)

Complexity

Constant.

See also

swaps the contents
(public member function) [edit]