function · 74 overloads
std::swap
- Draft
- [utility.swap]
- Scope
std- cppreference
- std::swap
Overloads
- (1)
- (2)
constexpr void swap(reference x, bool& y) noexcept; - (3)
void swap(Self& a, Self& b) noexcept; - (4)
void swap(Self& a, Self& b) noexcept; - (5)
void swap(Self& a, Self& b) noexcept; - (6)
- (7)
constexpr void swap(bool& x, reference y) noexcept; - (8)
constexpr void swap(exception_ptr& a, exception_ptr& b) noexcept; - (9)
constexpr void swap( expected& x, expected& y) noexcept(noexcept(x.swap(y))) requires requires { x.swap(y); }; - (10)
- (11)
constexpr void swap( flat_multimap& x, flat_multimap& y) noexcept(noexcept(x.swap(y))); - (12)
constexpr void swap( flat_multiset& x, flat_multiset& y) noexcept(noexcept(x.swap(y))); - (13)
- (14)
void swap(hazard_pointer& a, hazard_pointer& b) noexcept; - (15)
- (16)
void swap(inplace_stop_token& a, inplace_stop_token& b) noexcept; - (17)
constexpr void swap( inplace_vector& x, inplace_vector& y) noexcept(N == 0 || (is_nothrow_swappable_v<T> && is_nothrow_move_constructible_v<T>)); - (18)
- (19)
- (20)
constexpr void swap( polymorphic& lhs, polymorphic& rhs) noexcept(noexcept(lhs.swap(rhs))); - (21)
void swap(stop_source& a, stop_source& b) noexcept; - (22)
void swap(stop_token& a, stop_token& b) noexcept; - (23)
- (24)
constexpr void swap( unexpected& x, unexpected& y) noexcept(noexcept(x.swap(y))) requires is_swappable_v<E>; - (25)
template<class T> requires (is_constructible_v<T, T &&> && is_assignable_v<T&, T &&>) constexpr void swap( T& a, T& b) noexcept(is_nothrow_constructible_v<T, T &&> && is_nothrow_assignable_v<T &, T &&>); - (26)
template<class Allocator> void swap( basic_stacktrace<Allocator>& a, basic_stacktrace<Allocator>& b) noexcept(noexcept(a.swap(b))); - (27)
template<class T> requires (is_reference_v<T> || (is_move_constructible_v<T> && is_swappable_v<T>)) constexpr void swap( optional<T>& x, optional<T>& y) noexcept(noexcept(x.swap(y))); - (28)
template<class R> void swap(promise<R>& x, promise<R>& y) noexcept; - (29)
template<class Mutex> void swap(shared_lock<Mutex>& x, shared_lock<Mutex>& y) noexcept; - (30)
template<class T> constexpr void swap(shared_ptr<T>& a, shared_ptr<T>& b) noexcept; - (31)
template<class... Types> requires (is_swappable_v<Types> && ...) constexpr void swap( tuple<Types...>& x, tuple<Types...>& y) noexcept(noexcept(x.swap(y))); - (32)
template<class Mutex> void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y) noexcept; - (33)
template<class T> void swap(valarray<T>& x, valarray<T>& y) noexcept; - (34)
template<class... Types> requires ((is_move_constructible_v<Types> && is_swappable_v<Types>) && ...) constexpr void swap( variant<Types...>& v, variant<Types...>& w) noexcept(noexcept(v.swap(w))); - (35)
template<class T> constexpr void swap(weak_ptr<T>& a, weak_ptr<T>& b) noexcept; - (36)
template<class... Types> requires (is_swappable_v<const Types> && ...) constexpr void swap( const tuple<Types...>& x, const tuple<Types...>& y) noexcept(noexcept(x.swap(y))); - (37)
template<class T, size_t N> requires (N == 0 || is_swappable_v<T>) constexpr void swap( array<T, N>& x, array<T, N>& y) noexcept(noexcept(x.swap(y))); - (38)
template<class charT, class traits> void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y); - (39)
template<class charT, class traits> void swap(basic_fstream<charT, traits>& x, basic_fstream<charT, traits>& y); - (40)
template<class charT, class traits> void swap( basic_ifstream<charT, traits>& x, basic_ifstream<charT, traits>& y); - (41)
template<class charT, class traits> void swap( basic_ispanstream<charT, traits>& x, basic_ispanstream<charT, traits>& y); - (42)
template<class charT, class traits> void swap( basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y); - (43)
template<class charT, class traits> void swap( basic_ospanstream<charT, traits>& x, basic_ospanstream<charT, traits>& y); - (44)
template<class charT, class traits> void swap(basic_regex<charT, traits>& e1, basic_regex<charT, traits>& e2); - (45)
template<class charT, class traits> void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y); - (46)
template<class charT, class traits> void swap( basic_spanstream<charT, traits>& x, basic_spanstream<charT, traits>& y); - (47)
template<class T, class Allocator> constexpr void swap( deque<T, Allocator>& x, deque<T, Allocator>& y) noexcept(noexcept(x.swap(y))); - (48)
template<class T, class Allocator> constexpr void swap( forward_list<T, Allocator>& x, forward_list<T, Allocator>& y) noexcept(noexcept(x.swap(y))); - (49)
template<class T, class Allocator> void swap( hive<T, Allocator>& x, hive<T, Allocator>& y) noexcept(noexcept(x.swap(y))); - (50)
template<class T, class Allocator> constexpr void swap( list<T, Allocator>& x, list<T, Allocator>& y) noexcept(noexcept(x.swap(y))); - (51)
template<class BidirectionalIterator, class Allocator> void swap( match_results<BidirectionalIterator, Allocator>& m1, match_results<BidirectionalIterator, Allocator>& m2); - (52)
template<class R, class... ArgTypes> void swap( packaged_task<R(ArgTypes...)>& x, packaged_task<R(ArgTypes...)>& y) noexcept; - (53)
template<class T1, class T2> requires (is_swappable_v<T1> && is_swappable_v<T2>) constexpr void swap( pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y))); - (54)
template<class T, class Container> requires is_swappable_v<Container> constexpr void swap( queue<T, Container>& x, queue<T, Container>& y) noexcept(noexcept(x.swap(y))); - (55)
template<class T, class Container> requires is_swappable_v<Container> constexpr void swap( stack<T, Container>& x, stack<T, Container>& y) noexcept(noexcept(x.swap(y))); - (56)
template<class T, class D> requires is_swappable_v<D> constexpr void swap(unique_ptr<T, D>& x, unique_ptr<T, D>& y) noexcept; - (57)
template<class T, class Allocator> constexpr void swap( vector<T, Allocator>& x, vector<T, Allocator>& y) noexcept(noexcept(x.swap(y))); - (58)
template<class T1, class T2> requires (is_swappable_v<const T1> && is_swappable_v<const T2>) constexpr void swap( const pair<T1, T2>& x, const pair<T1, T2>& y) noexcept(noexcept(x.swap(y))); - (59)
template<class T, size_t N> requires swappable-elem<T>::value constexpr void swap( T(& a)[], T(& b)[]) noexcept(swappable-elem<T>::nothrow); - (60)
template<class charT, class traits, class Allocator> void swap( basic_istringstream<charT, traits, Allocator>& x, basic_istringstream<charT, traits, Allocator>& y); - (61)
template<class charT, class traits, class Allocator> void swap( basic_ostringstream<charT, traits, Allocator>& x, basic_ostringstream<charT, traits, Allocator>& y); - (62)
template<class charT, class traits, class Allocator> constexpr void swap( basic_string<charT, traits, Allocator>& lhs, basic_string<charT, traits, Allocator>& rhs) noexcept(noexcept(lhs.swap(rhs))); - (63)
template<class charT, class traits, class Allocator> void swap( basic_stringbuf<charT, traits, Allocator>& x, basic_stringbuf<charT, traits, Allocator>& y) noexcept(noexcept(x.swap(y))); - (64)
template<class charT, class traits, class Allocator> void swap( basic_stringstream<charT, traits, Allocator>& x, basic_stringstream<charT, traits, Allocator>& y); - (65)
template<class charT, class traits, class Allocator> void swap( basic_syncbuf<charT, traits, Allocator>& a, basic_syncbuf<charT, traits, Allocator>& b); - (66)
template<class Key, class Compare, class Allocator> constexpr void swap( multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y) noexcept(noexcept(x.swap(y))); - (67)
template<class T, class Container, class Compare> requires is_swappable_v<Container> && is_swappable_v<Compare> constexpr void swap( priority_queue<T, Container, Compare>& x, priority_queue<T, Container, Compare>& y) noexcept(noexcept(x.swap(y))); - (68)
template<class Key, class Compare, class Allocator> constexpr void swap( set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y) noexcept(noexcept(x.swap(y))); - (69)
template<class Key, class T, class Compare, class Allocator> constexpr void swap( map<Key, T, Compare, Allocator>& x, map<Key, T, Compare, Allocator>& y) noexcept(noexcept(x.swap(y))); - (70)
template<class Key, class T, class Compare, class Allocator> constexpr void swap( multimap<Key, T, Compare, Allocator>& x, multimap<Key, T, Compare, Allocator>& y) noexcept(noexcept(x.swap(y))); - (71)
template<class Key, class Hash, class Pred, class Alloc> constexpr void swap( unordered_multiset<Key, Hash, Pred, Alloc>& x, unordered_multiset<Key, Hash, Pred, Alloc>& y) noexcept(noexcept(x.swap(y))); - (72)
template<class Key, class Hash, class Pred, class Alloc> constexpr void swap( unordered_set<Key, Hash, Pred, Alloc>& x, unordered_set<Key, Hash, Pred, Alloc>& y) noexcept(noexcept(x.swap(y))); - (73)
template<class Key, class T, class Hash, class Pred, class Alloc> constexpr void swap( unordered_map<Key, T, Hash, Pred, Alloc>& x, unordered_map<Key, T, Hash, Pred, Alloc>& y) noexcept(noexcept(x.swap(y))); - (74)
template<class Key, class T, class Hash, class Pred, class Alloc> constexpr void swap( unordered_multimap<Key, T, Hash, Pred, Alloc>& x, unordered_multimap<Key, T, Hash, Pred, Alloc>& y) noexcept(noexcept(x.swap(y)));