Difference between revisions of "cpp/container/mdspan/swap2"
From cppreference.com
m (fmt.) |
m (~links.) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{title|swap{{small|(std::mdspan)}}}} |
{{cpp/container/mdspan/navbar}} | {{cpp/container/mdspan/navbar}} | ||
− | {{ddcl | + | {{ddcl|since=c++23| |
friend constexpr void swap( mdspan& x, mdspan& y ) noexcept; | friend constexpr void swap( mdspan& x, mdspan& y ) noexcept; | ||
}} | }} | ||
− | Overloads the {{ | + | Overloads the {{ltt|cpp/utility/swap|std::swap}} algorithm for {{rlpt|/|std::mdspan}}. Exchanges the state of {{c|x}} with that of {{c|y}}. Equivalent to: |
− | + | {{box| | |
− | {{ | + | {{c/core|std::}}{{ltt|cpp/utility/swap}}{{c/core|(x.}}{{rlpsi|/#acc_}}{{c/core|, y.}}{{rlpsi|/#acc_}}{{c/core|);}}<br> |
− | + | {{c/core|std::}}{{ltt|cpp/utility/swap}}{{c/core|(x.}}{{rlpsi|/#map_}}{{c/core|, y.}}{{rlpsi|/#map_}}{{c/core|);}}<br> | |
− | std::swap(x.map_, y.map_); | + | {{c/core|std::}}{{ltt|cpp/utility/swap}}{{c/core|(x.}}{{rlpsi|/#ptr_}}{{c/core|, y.}}{{rlpsi|/#ptr_}}{{c/core|);}} |
− | std::swap(x. | + | |
}} | }} | ||
+ | |||
+ | {{cpp/hidden friend|{{tt|std::mdspan}}}} | ||
===Parameters=== | ===Parameters=== | ||
Line 24: | Line 25: | ||
===Example=== | ===Example=== | ||
− | {{example|code= | + | {{example |
+ | |code= | ||
|output= | |output= | ||
}} | }} |
Latest revision as of 15:13, 18 October 2024
friend constexpr void swap( mdspan& x, mdspan& y ) noexcept; |
(since C++23) | |
Overloads the std::swap algorithm for std::mdspan
. Exchanges the state of x with that of y. Equivalent to:
std::swap(x.acc_
, y.acc_
);
std::swap(x.map_
, y.map_
);
std::swap(x.ptr_
, y.ptr_
);
This function is not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when std::mdspan
is an associated class of the arguments.
Contents |
[edit] Parameters
x, y | - | mdspan objects whose states to swap
|
[edit] Return value
(none)
[edit] Example
This section is incomplete Reason: no example |
[edit] See also
This section is incomplete |