swap overloads
Synopses
Declared in <bslstl_deque.h>
Exchange the stop states referred to by lhs and rhs.
void
swap(
stop_source& lhs,
stop_source& rhs) noexcept;
Exchange the stop states referred to by lhs and rhs.
void
swap(
stop_token& lhs,
stop_token& rhs) noexcept;
Exchange the values of the specified a and b objects.
Exchange the targets held by the specified a and b functions.
template<class PROTOTYPE>
void
swap(
function<PROTOTYPE>& a,
function<PROTOTYPE>& b) noexcept;
Exchange the values of two optionals.
template<class t_TYPE>
void
swap(
bsl::optional<t_TYPE>& lhs,
bsl::optional<t_TYPE>& rhs)
requires BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value;
Exchange the values of two optionals.
template<class t_TYPE>
constexpr
void
swap(
bsl::optional<t_TYPE>& lhs,
bsl::optional<t_TYPE>& rhs)
requires !BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value;
Exchange the values of two optionals.
template<class t_TYPE>
void
swap(
bsl::optional<t_TYPE>& lhs,
std::optional<t_TYPE>& rhs)
requires !BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value;
Exchange the values of the specified lhs and rhs optional objects.
template<class t_TYPE>
constexpr
void
swap(
std::optional<t_TYPE>& lhs,
bsl::optional<t_TYPE>& rhs)
requires !BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value;
Exchange the states of the specified shared_ptr objects a and b.
template<class ELEMENT_TYPE>
void
swap(
shared_ptr<ELEMENT_TYPE>& a,
shared_ptr<ELEMENT_TYPE>& b) noexcept;
Exchange the states of the specified weak_ptr objects a and b.
template<class ELEMENT_TYPE>
void
swap(
weak_ptr<ELEMENT_TYPE>& a,
weak_ptr<ELEMENT_TYPE>& b) noexcept;
Exchange the values of the specified a and b deques.
template<
class VALUE_TYPE,
class ALLOCATOR>
void
swap(
deque<VALUE_TYPE, ALLOCATOR>& a,
deque<VALUE_TYPE, ALLOCATOR>& b) noexcept(noexcept(a.swap(b)));
Exchange the values of the specified a and b lists.
template<
class VALUE,
class ALLOCATOR>
void
swap(
list<VALUE, ALLOCATOR>& a,
list<VALUE, ALLOCATOR>& b) noexcept(noexcept(a.swap(b)));
Swap the values of the specified a and b pairs.
template<
class T1,
class T2>
void
swap(
pair<T1, T2>& a,
pair<T1, T2>& b) noexcept(noexcept(a.swap(b)))
requires bsl::is_swappable<T1>::value && bsl::is_swappable<T2>::value;
Swap the values of the specified lhs and rhs queues.
template<
class VALUE,
class CONTAINER>
void
swap(
queue<VALUE, CONTAINER>& lhs,
queue<VALUE, CONTAINER>& rhs) noexcept(false);
Swap the value of the specified lhs stack with the value of the specified rhs stack.
template<
class VALUE,
class CONTAINER>
void
swap(
stack<VALUE, CONTAINER>& lhs,
stack<VALUE, CONTAINER>& rhs) noexcept(false);
Efficiently exchange the values of the specified lhs and rhs objects.
template<
class t_HEAD,
class... t_TAIL>
void
swap(
bsl::variant<t_HEAD, t_TAIL...>& lhs,
bsl::variant<t_HEAD, t_TAIL...>& rhs);
Exchange the contents of two vectors.
template<
class VALUE_TYPE,
class ALLOCATOR>
void
swap(
vector<VALUE_TYPE, ALLOCATOR>& a,
vector<VALUE_TYPE, ALLOCATOR>& b) noexcept(noexcept(a.swap(b)));
Efficiently exchange the values of the specified a and b objects.
template<
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
void
swap(
basic_istringstream<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>& a,
basic_istringstream<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>& b);
Efficiently exchange the values of the specified a and b objects.
template<
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
void
swap(
basic_ostringstream<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>& a,
basic_ostringstream<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>& b);
Exchange the contents of two strings.
template<
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
void
swap(
basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>& a,
basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>& b) noexcept(noexcept(a.swap(b)));
Efficiently exchange the values of the specified a and b objects.
template<
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
void
swap(
basic_stringbuf<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>& a,
basic_stringbuf<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>& b);
Efficiently exchange the values of the specified a and b objects.
template<
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
void
swap(
basic_stringstream<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>& a,
basic_stringstream<CHAR_TYPE, CHAR_TRAITS, ALLOCATOR>& b);
Swap the specified a with the specified b using a.swap(b) expression.
template<
class CHAR,
class TRAITS,
class ALLOCATOR>
void
swap(
basic_syncbuf<CHAR, TRAITS, ALLOCATOR>& a,
basic_syncbuf<CHAR, TRAITS, ALLOCATOR>& b);
Exchange the values of the specified a and b multisets.
template<
class KEY,
class COMPARATOR,
class ALLOCATOR>
void
swap(
multiset<KEY, COMPARATOR, ALLOCATOR>& a,
multiset<KEY, COMPARATOR, ALLOCATOR>& b) noexcept(noexcept(a.swap(b)));
Exchange the container and comparator of a with those of b.
template<
class VALUE,
class CONTAINER,
class COMPARATOR>
void
swap(
priority_queue<VALUE, CONTAINER, COMPARATOR>& a,
priority_queue<VALUE, CONTAINER, COMPARATOR>& b) noexcept(false);
Exchange the value and comparator of a with those of b.
template<
class KEY,
class COMPARATOR,
class ALLOCATOR>
void
swap(
set<KEY, COMPARATOR, ALLOCATOR>& a,
set<KEY, COMPARATOR, ALLOCATOR>& b) noexcept(noexcept(a.swap(b)));
Exchange the contents of the specified hash multisets.
template<
class _Value,
class _HashFcn,
class _EqualKey,
class _Alloc>
void
swap(
hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>& lhs,
hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>& rhs);
Exchange the contents of the specified hash sets.
template<
class _Value,
class _HashFcn,
class _EqualKey,
class _Alloc>
void
swap(
hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& lhs,
hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& rhs);
Exchange the value and comparator of a with those of b.
template<
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
void
swap(
map<KEY, VALUE, COMPARATOR, ALLOCATOR>& a,
map<KEY, VALUE, COMPARATOR, ALLOCATOR>& b) noexcept(false);
Exchange the value and comparator of a with those of b.
template<
class KEY,
class VALUE,
class COMPARATOR,
class ALLOCATOR>
void
swap(
multimap<KEY, VALUE, COMPARATOR, ALLOCATOR>& a,
multimap<KEY, VALUE, COMPARATOR, ALLOCATOR>& b) noexcept(false);
Exchange the values of the specified a and b objects.
template<
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
void
swap(
unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& a,
unordered_multiset<KEY, HASH, EQUAL, ALLOCATOR>& b) noexcept(noexcept(a.swap(b)));
Exchange the contents of a and b.
template<
class KEY,
class HASH,
class EQUAL,
class ALLOCATOR>
void
swap(
unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& a,
unordered_set<KEY, HASH, EQUAL, ALLOCATOR>& b) noexcept(noexcept(a.swap(b)));
Exchange the contents of the specified hash maps.
template<
class _Key,
class _Tp,
class _HashFcn,
class _EqualKey,
class _Alloc>
void
swap(
hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc>& lhs,
hash_map<_Key, _Tp, _HashFcn, _EqualKey, _Alloc>& rhs);
Exchange the contents of the specified hash multimaps.
template<
class _Key,
class _Tp,
class _HashFcn,
class _EqualKey,
class _Alloc>
void
swap(
hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc>& lhs,
hash_multimap<_Key, _Tp, _HashFcn, _EqualKey, _Alloc>& rhs);
Exchange the contents of a with those of b.
template<
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
void
swap(
unordered_map<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& a,
unordered_map<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& b) noexcept(false);
Exchange the value of a with that of b.
template<
class KEY,
class VALUE,
class HASH,
class EQUAL,
class ALLOCATOR>
void
swap(
unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& a,
unordered_multimap<KEY, VALUE, HASH, EQUAL, ALLOCATOR>& b) noexcept(false);
Parameters
Name |
Description |
lhs |
first source participating in the swap |
rhs |
second source participating in the swap |
a |
first vector to swap |
b |
second vector to swap |
Created with MrDocs