Files
2025-10-25 03:02:53 +03:00

1.9 KiB

[tuple.swap]

22 General utilities library [utilities]

22.4 Tuples [tuple]

22.4.4 Class template tuple [tuple.tuple]

22.4.4.4 swap [tuple.swap]

🔗

constexpr void swap(tuple& rhs) noexcept(see below); constexpr void swap(const tuple& rhs) const noexcept(see below);

1

#

Let i be in the range [0, sizeof...(Types)) in order.

2

#

Mandates:

  • (2.1)

    For the first overload,(is_swappable_v && ...) is true.

  • (2.2)

    For the second overload,(is_swappable_v && ...) is true.

3

#

Preconditions: For all i, get(*this) is swappable with ([swappable.requirements]) get(rhs).

4

#

Effects: For each i, calls swap for get(*this) and get(rhs).

5

#

Throws: Nothing unless one of the element-wise swap calls throws an exception.

6

#

Remarks: The exception specification is equivalent to

(is_nothrow_swappable_v && ...) for the first overload and

(is_nothrow_swappable_v && ...) for the second overload.