libycxx

function · 74 overloads

std::swap

Header
<utility> also in <any>, <array>, <deque>, <forward_list>, <fstream> and 25 more
Scope
std
cppreference
std::swap

Overloads

  1. constexpr void swap(reference x, reference y) noexcept;
    (1)
  2. constexpr void swap(reference x, bool& y) noexcept;
    (2)
  3. void swap(Self& a, Self& b) noexcept;
    (3)
  4. void swap(Self& a, Self& b) noexcept;
    (4)
  5. void swap(Self& a, Self& b) noexcept;
    (5)
  6. void swap(any& x, any& y) noexcept;
    (6)
  7. constexpr void swap(bool& x, reference y) noexcept;
    (7)
  8. constexpr void swap(exception_ptr& a, exception_ptr& b) noexcept;
    (8)
  9. constexpr void swap(
        expected& x,
        expected& y) noexcept(noexcept(x.swap(y)))  requires requires { x.swap(y); };
    (9)
  10. constexpr void swap(flat_map& x, flat_map& y) noexcept(noexcept(x.swap(y)));
    (10)
  11. constexpr void swap(
        flat_multimap& x,
        flat_multimap& y) noexcept(noexcept(x.swap(y)));
    (11)
  12. constexpr void swap(
        flat_multiset& x,
        flat_multiset& y) noexcept(noexcept(x.swap(y)));
    (12)
  13. constexpr void swap(flat_set& x, flat_set& y) noexcept(noexcept(x.swap(y)));
    (13)
  14. void swap(hazard_pointer& a, hazard_pointer& b) noexcept;
    (14)
  15. constexpr void swap(
        indirect& lhs,
        indirect& rhs) noexcept(noexcept(lhs.swap(rhs)));
    (15)
  16. void swap(inplace_stop_token& a, inplace_stop_token& b) noexcept;
    (16)
  17. constexpr void swap(
        inplace_vector& x,
        inplace_vector& y) noexcept(N == 0 || (is_nothrow_swappable_v<T> && is_nothrow_move_constructible_v<T>));
    (17)
  18. void swap(jthread& lhs, jthread& rhs) noexcept;
    (18)
  19. constexpr void swap(mdspan& x, mdspan& y) noexcept;
    (19)
  20. constexpr void swap(
        polymorphic& lhs,
        polymorphic& rhs) noexcept(noexcept(lhs.swap(rhs)));
    (20)
  21. void swap(stop_source& a, stop_source& b) noexcept;
    (21)
  22. void swap(stop_token& a, stop_token& b) noexcept;
    (22)
  23. void swap(thread& x, thread& y) noexcept;
    (23)
  24. constexpr void swap(
        unexpected& x,
        unexpected& y) noexcept(noexcept(x.swap(y)))  requires is_swappable_v<E>;
    (24)
  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 &&>);
    (25)
  26. template<class Allocator>
    void swap(
        basic_stacktrace<Allocator>& a,
        basic_stacktrace<Allocator>& b) noexcept(noexcept(a.swap(b)));
    (26)
  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)));
    (27)
  28. template<class R>
    void swap(promise<R>& x, promise<R>& y) noexcept;
    (28)
  29. template<class Mutex>
    void swap(shared_lock<Mutex>& x, shared_lock<Mutex>& y) noexcept;
    (29)
  30. template<class T>
    constexpr void swap(shared_ptr<T>& a, shared_ptr<T>& b) noexcept;
    (30)
  31. template<class... Types>
      requires (is_swappable_v<Types> && ...)
    constexpr void swap(
        tuple<Types...>& x,
        tuple<Types...>& y) noexcept(noexcept(x.swap(y)));
    (31)
  32. template<class Mutex>
    void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y) noexcept;
    (32)
  33. template<class T>
    void swap(valarray<T>& x, valarray<T>& y) noexcept;
    (33)
  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)));
    (34)
  35. template<class T>
    constexpr void swap(weak_ptr<T>& a, weak_ptr<T>& b) noexcept;
    (35)
  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)));
    (36)
  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)));
    (37)
  38. template<class charT, class traits>
    void swap(basic_filebuf<charT, traits>& x, basic_filebuf<charT, traits>& y);
    (38)
  39. template<class charT, class traits>
    void swap(basic_fstream<charT, traits>& x, basic_fstream<charT, traits>& y);
    (39)
  40. template<class charT, class traits>
    void swap(
        basic_ifstream<charT, traits>& x,
        basic_ifstream<charT, traits>& y);
    (40)
  41. template<class charT, class traits>
    void swap(
        basic_ispanstream<charT, traits>& x,
        basic_ispanstream<charT, traits>& y);
    (41)
  42. template<class charT, class traits>
    void swap(
        basic_ofstream<charT, traits>& x,
        basic_ofstream<charT, traits>& y);
    (42)
  43. template<class charT, class traits>
    void swap(
        basic_ospanstream<charT, traits>& x,
        basic_ospanstream<charT, traits>& y);
    (43)
  44. template<class charT, class traits>
    void swap(basic_regex<charT, traits>& e1, basic_regex<charT, traits>& e2);
    (44)
  45. template<class charT, class traits>
    void swap(basic_spanbuf<charT, traits>& x, basic_spanbuf<charT, traits>& y);
    (45)
  46. template<class charT, class traits>
    void swap(
        basic_spanstream<charT, traits>& x,
        basic_spanstream<charT, traits>& y);
    (46)
  47. template<class T, class Allocator>
    constexpr void swap(
        deque<T, Allocator>& x,
        deque<T, Allocator>& y) noexcept(noexcept(x.swap(y)));
    (47)
  48. template<class T, class Allocator>
    constexpr void swap(
        forward_list<T, Allocator>& x,
        forward_list<T, Allocator>& y) noexcept(noexcept(x.swap(y)));
    (48)
  49. template<class T, class Allocator>
    void swap(
        hive<T, Allocator>& x,
        hive<T, Allocator>& y) noexcept(noexcept(x.swap(y)));
    (49)
  50. template<class T, class Allocator>
    constexpr void swap(
        list<T, Allocator>& x,
        list<T, Allocator>& y) noexcept(noexcept(x.swap(y)));
    (50)
  51. template<class BidirectionalIterator, class Allocator>
    void swap(
        match_results<BidirectionalIterator, Allocator>& m1,
        match_results<BidirectionalIterator, Allocator>& m2);
    (51)
  52. template<class R, class... ArgTypes>
    void swap(
        packaged_task<R(ArgTypes...)>& x,
        packaged_task<R(ArgTypes...)>& y) noexcept;
    (52)
  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)));
    (53)
  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)));
    (54)
  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)));
    (55)
  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;
    (56)
  57. template<class T, class Allocator>
    constexpr void swap(
        vector<T, Allocator>& x,
        vector<T, Allocator>& y) noexcept(noexcept(x.swap(y)));
    (57)
  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)));
    (58)
  59. template<class T, size_t N>
      requires swappable-elem<T>::value
    constexpr void swap(
        T(& a)[],
        T(& b)[]) noexcept(swappable-elem<T>::nothrow);
    (59)
  60. template<class charT, class traits, class Allocator>
    void swap(
        basic_istringstream<charT, traits, Allocator>& x,
        basic_istringstream<charT, traits, Allocator>& y);
    (60)
  61. template<class charT, class traits, class Allocator>
    void swap(
        basic_ostringstream<charT, traits, Allocator>& x,
        basic_ostringstream<charT, traits, Allocator>& y);
    (61)
  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)));
    (62)
  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)));
    (63)
  64. template<class charT, class traits, class Allocator>
    void swap(
        basic_stringstream<charT, traits, Allocator>& x,
        basic_stringstream<charT, traits, Allocator>& y);
    (64)
  65. template<class charT, class traits, class Allocator>
    void swap(
        basic_syncbuf<charT, traits, Allocator>& a,
        basic_syncbuf<charT, traits, Allocator>& b);
    (65)
  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)));
    (66)
  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)));
    (67)
  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)));
    (68)
  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)));
    (69)
  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)));
    (70)
  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)));
    (71)
  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)));
    (72)
  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)));
    (73)
  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)));
    (74)