swap overloads
Declared in <bslstl_deque.h>
Set lhs to refer to the stop state (or lack thereof) that rhs referred to before the call, and vice versa. Implementation note: this function is required by the standard to be a hidden friend ([hidden.friends], [stopsource.general]).
void
swap(
stop_source& lhs,
stop_source& rhs) noexcept;
» more...
Set lhs to refer to the stop state (or lack thereof) that rhs referred to, and vice versa. Implementation note: this function is required by the standard to be a hidden friend ([hidden.friends], [stoptoken.general]).
void
swap(
stop_token& lhs,
stop_token& rhs) noexcept;
» more...
Exchange the values of the specified a and b objects.
void
swap(
vector& a,
vector& b) noexcept(noexcept(a.d_impl.swap(b.d_impl)));
» more...
Exchange the values of the specified a and b objects.
void
swap(
vector<void*>& a,
vector<void*>& b) noexcept(noexcept(a.d_impl.swap(b.d_impl)));
» more...
Exchange the values of the specified a and b objects.
void
swap(
vector<char const*>& a,
vector<char const*>& b) noexcept(noexcept(a.d_impl.swap(b.d_impl)));
» more...
Exchange the targets held by the specified a and specified b objects. The behavior is undefined unless 'a.get_allocator() == b.get_allocator()'.
template<class PROTOTYPE>
void
swap(
function<PROTOTYPE>& a,
function<PROTOTYPE>& b) noexcept;
» more...
Efficiently exchange the values of the specified lhs and rhs objects. This method provides the no-throw exception-safety guarantee if the template parameter t_TYPE provides that guarantee, lhs and rhs have equal allocators, and lhs.hasValue() == rhs.hasValue().
template<class t_TYPE>
void
swap(
bsl::optional<t_TYPE>& lhs,
bsl::optional<t_TYPE>& rhs)
requires BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value;
» more...
Efficiently exchange the values of the specified lhs and rhs objects. This method provides the no-throw exception-safety guarantee if the template parameter t_TYPE provides that guarantee and the result of the hasValue method for lhs and rhs is the same.
template<class t_TYPE>
constexpr
void
swap(
bsl::optional<t_TYPE>& lhs,
bsl::optional<t_TYPE>& rhs)
requires !BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value;
» more...
Efficiently exchange the values of the specified lhs and rhs objects. This method provides the no-throw exception-safety guarantee if the template parameter t_TYPE provides that guarantee and the result of the hasValue method for lhs and rhs is the same. This function can be called in constant expressions only if t_TYPE is not allocator-aware.
template<class t_TYPE>
void
swap(
bsl::optional<t_TYPE>& lhs,
std::optional<t_TYPE>& rhs)
requires !BloombergLP::bslma::UsesBslmaAllocator<t_TYPE>::value;
» more...
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;
» more...
Efficiently exchange the states of the specified a and b shared pointers such that each will refer to the object formerly referred to by the other, and each will manage the object formerly managed by the other.
template<class ELEMENT_TYPE>
void
swap(
shared_ptr<ELEMENT_TYPE>& a,
shared_ptr<ELEMENT_TYPE>& b) noexcept;
» more...
Efficiently exchange the states of the specified a and b weak pointers such that each will refer to the object (if any) and representation formerly referred to by the other.
template<class ELEMENT_TYPE>
void
swap(
weak_ptr<ELEMENT_TYPE>& a,
weak_ptr<ELEMENT_TYPE>& b) noexcept;
» more...
Exchange the value of the specified a object with that of the specified b object; also exchange the allocator of a with that of b if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This function provides the no-throw exception-safety guarantee. This operation has O[1] complexity if either a was created with the same allocator as b or ALLOCATOR has the propagate_on_container_swap trait; otherwise, it has O[n + m] complexity, where n and m are the number of elements in a and b, respectively. Note that this function`s support for swapping objects created with different allocators when ALLOCATOR does not have the propagate_on_container_swap trait is a departure from the C++ Standard.
template<
class VALUE_TYPE,
class ALLOCATOR>
void
swap(
deque<VALUE_TYPE, ALLOCATOR>& a,
deque<VALUE_TYPE, ALLOCATOR>& b) noexcept(noexcept(a.swap(b)));
» more...
Exchange the value of the specified a object with that of the specified b object; also exchange the allocator of a with that of b if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This function provides the no-throw exception-safety guarantee. This operation has O[1] complexity if either a was created with the same allocator as b or ALLOCATOR has the propagate_on_container_swap trait; otherwise, it has O[n + m] complexity, where n and m are the number of elements in a and b, respectively. Note that this function`s support for swapping objects created with different allocators when ALLOCATOR does not have the propagate_on_container_swap trait is a departure from the C++ Standard.
template<
class VALUE,
class ALLOCATOR>
void
swap(
list<VALUE, ALLOCATOR>& a,
list<VALUE, ALLOCATOR>& b) noexcept(noexcept(a.swap(b)));
» more...
Swap the values of the specified a and b pairs by applying swap to each of the first and second pair fields. Note that this method is no-throw only if swap on each field is no-throw.
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;
» more...
Swap the value of the specified lhs queue with the value of the specified rhs queue.
template<
class VALUE,
class CONTAINER>
void
swap(
queue<VALUE, CONTAINER>& lhs,
queue<VALUE, CONTAINER>& rhs) noexcept(false);
» more...
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);
» more...
Efficiently exchange the values of the specified lhs and rhs objects. This method provides the no-throw guarantee if the two variant objects being swapped have the same active alternative and that alternative provides that guarantee; otherwise, this method provides the basic guarantee. If lhs and rhs do not contain the same alternative or they have unequal allocators, and an exception is thrown during the swap, either or both variant objects may be left in a valueless state or with an alternative in a moved-from state. All alternatives shall be move constructible and swappable. For simplicity of implementation, this function differs from the standard in the following : * constraints are not implemented * constexpr is not implemented
template<
class t_HEAD,
class... t_TAIL>
void
swap(
bsl::variant<t_HEAD, t_TAIL...>& lhs,
bsl::variant<t_HEAD, t_TAIL...>& rhs);
» more...
Exchange the value of the specified a object with that of the specified b object; also exchange the allocator of a with that of b if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This function provides the no-throw exception-safety guarantee. This operation has O[1] complexity if either a was created with the same allocator as b or ALLOCATOR has the propagate_on_container_swap trait; otherwise, it has O[n + m] complexity, where n and m are the number of elements in a and b, respectively. Note that this function`s support for swapping objects created with different allocators when ALLOCATOR does not have the propagate_on_container_swap trait is a departure from the C++ Standard.
template<
class VALUE_TYPE,
class ALLOCATOR>
void
swap(
vector<VALUE_TYPE, ALLOCATOR>& a,
vector<VALUE_TYPE, ALLOCATOR>& b) noexcept(noexcept(a.swap(b)));
» more...
Efficiently exchange the values of the specified a and b objects. This method provides the no-throw exception-safety guarantee if a and b allocators compare equal. Note that this function is only available for C++11 (and later) language standards.
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);
» more...
Efficiently exchange the values of the specified a and b objects. This method provides the no-throw exception-safety guarantee if a and b allocators compare equal. Note that this function is only available for C++11 (and later) language standards.
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);
» more...
Exchange the value of the specified a object with that of the specified b object; also exchange the allocator of a with that of b if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This function provides the no-throw exception-safety guarantee. This operation has O[1] complexity if either a was created with the same allocator as b or ALLOCATOR has the propagate_on_container_swap trait; otherwise, it has O[n + m] complexity, where n and m are the lengths of a and b, respectively. Note that this function`s support for swapping objects created with different allocators when ALLOCATOR does not have the propagate_on_container_swap trait is a departure from the C++ Standard.
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)));
» more...
Efficiently exchange the values of the specified a and b objects. This method provides the no-throw exception-safety guarantee if a and b allocators compare equal. Note that this function is only available for C++11 (and later) language standards.
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);
» more...
Efficiently exchange the values of the specified a and b objects. This method provides the no-throw exception-safety guarantee if a and b allocators compare equal. Note that this function is only available for C++11 (and later) language standards.
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);
» more...
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);
» more...
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)));
» more...
Exchange the container and comparator of the specified a object with the container and comparator of the specified b object.
template<
class VALUE,
class CONTAINER,
class COMPARATOR>
void
swap(
priority_queue<VALUE, CONTAINER, COMPARATOR>& a,
priority_queue<VALUE, CONTAINER, COMPARATOR>& b) noexcept(false);
» more...
Exchange the value and comparator of the specified a object with those of the specified b object; also exchange the allocator of a with that of b if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This function provides the no-throw exception-safety guarantee if and only if the (template parameter) type COMPARATOR provides a no-throw swap operation, and provides the basic exception-safety guarantee otherwise; if an exception is thrown, both objects are left in valid but unspecified states. This operation has O[1] complexity if either a was created with the same allocator as b or ALLOCATOR has the propagate_on_container_swap trait; otherwise, it has O[n + m] complexity, where n and m are the number of elements in a and b, respectively. Note that this function`s support for swapping objects created with different allocators when ALLOCATOR does not have the propagate_on_container_swap trait is a departure from the C++ Standard.
template<
class KEY,
class COMPARATOR,
class ALLOCATOR>
void
swap(
set<KEY, COMPARATOR, ALLOCATOR>& a,
set<KEY, COMPARATOR, ALLOCATOR>& b) noexcept(noexcept(a.swap(b)));
» more...
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);
» more...
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);
» more...
Exchange the value and comparator of the specified a object with those of the specified b object; also exchange the allocator of a with that of b if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This function provides the no-throw exception-safety guarantee if and only if the (template parameter) type COMPARATOR provides a no-throw swap operation, and provides the basic exception-safety guarantee otherwise; if an exception is thrown, both objects are left in valid but unspecified states. This operation has O[1] complexity if either a was created with the same allocator as b or ALLOCATOR has the propagate_on_container_swap trait; otherwise, it has O[n + m] complexity, where n and m are the number of elements in a and b, respectively. Note that this function's support for swapping objects created with different allocators when ALLOCATOR does not have the propagate_on_container_swap trait is a departure from the C++ Standard.
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);
» more...
Exchange the value and comparator of the specified a object with those of the specified b object; also exchange the allocator of a with that of b if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This function provides the no-throw exception-safety guarantee if and only if the (template parameter) type COMPARATOR provides a no-throw swap operation, and provides the basic exception-safety guarantee otherwise; if an exception is thrown, both objects are left in valid but unspecified states. This operation has O[1] complexity if either a was created with the same allocator as b or ALLOCATOR has the propagate_on_container_swap trait; otherwise, it has O[n + m] complexity, where n and m are the number of elements in a and b, respectively. Note that this function's support for swapping objects created with different allocators when ALLOCATOR does not have the propagate_on_container_swap trait is a departure from the C++ Standard.
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);
» more...
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)));
» more...
Exchange the value, hasher, key-equality functor, and max_load_factor of the specified a object with those of the specified b object; also exchange the allocator of a with that of b if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This function provides the no-throw exception-safety guarantee if and only if both the (template parameter) types HASH and EQUAL provide no-throw swap operations; if an exception is thrown, both objects are left in valid but unspecified states. This operation guarantees O[1] complexity. The behavior is undefined unless either a was created with the same allocator as b or ALLOCATOR has the propagate_on_container_swap trait.
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)));
» more...
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);
» more...
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);
» more...
Exchange the value, hasher, key-equality functor, and max_load_factor of the specified a object with those of the specified b object; also exchange the allocator of a with that of b if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This function provides the no-throw exception-safety guarantee if and only if both the (template parameter) types HASH and EQUAL provide no-throw swap operations; if an exception is thrown, both objects are left in valid but unspecified states. This operation guarantees O[1] complexity. The behavior is undefined unless either a was created with the same allocator as b or ALLOCATOR has the propagate_on_container_swap trait.
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);
» more...
Exchange the value, hasher, key-equality functor, and max_load_factor of the specified a object with those of the specified b object; also exchange the allocator of a with that of b if the (template parameter) type ALLOCATOR has the propagate_on_container_swap trait, and do not modify either allocator otherwise. This function provides the no-throw exception-safety guarantee if and only if both the (template parameter) types HASH and EQUAL provide no-throw swap operations; if an exception is thrown, both objects are left in valid but unspecified states. This operation guarantees O[1] complexity. The behavior is undefined unless either a was created with the same allocator as b or ALLOCATOR has the propagate_on_container_swap trait.
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);
» more...