Kokkos::kokkos_swap
#
Defined in header <Kokkos_Swap.hpp>
(since 4.3) which is included from <Kokkos_Core.hpp>
template <class T>
KOKKOS_FUNCTION constexpr void
kokkos_swap(T& a, T& b) noexcept(std::is_nothrow_move_constructible_v<T> &&
std::is_nothrow_move_assignable_v<T>); // (1) (since 4.3)
template <class T2, std::size_t N>
KOKKOS_FUNCTION constexpr void
kokkos_swap(T2 (&a)[N], T2 (&b)[N]) noexcept(noexcept(*a, *b)); // (2) (since 4.3)
Swaps the values
a
andb
. This overload does not participate in overload resolution unlessstd::is_move_constructible_v<T> && std::is_move_assignable_v<T>
istrue
.Swaps the arrays
a
andb
. This overload does not participate in overload resolution unlessT2
is swappable.
Notes#
kokkos_swap
provides the same functionality as std::swap
. It just
cannot be called swap
or it would yield some ambiguities in overload
resolution in some situations because of ADL.