cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
swap.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_FUNCTIONS_SWAP_H
4#define pRC_CORE_TENSOR_FUNCTIONS_SWAP_H
5
10
11namespace pRC
12{
13 template<class XA, class XB, IsTensorish RA = RemoveReference<XA>,
14 IsTensorish RB = RemoveReference<XB>,
15 class EA = ResultOf<XA, typename RA::Subscripts>,
16 class EB = ResultOf<XB, typename RB::Subscripts>>
17 requires IsSame<typename RA::Sizes, typename RB::Sizes> &&
18 IsInvocable<Swap, EA, EB> && IsInvocable<View, XA> &&
19 IsInvocable<View, XB>
20 static inline constexpr auto swap(XA &&a, XB &&b)
21 {
23 [&a, &b](auto const... indices)
24 {
25 swap(forward<XA>(a)(indices...), forward<XB>(b)(indices...));
26 });
27 }
28}
29#endif // pRC_CORE_TENSOR_FUNCTIONS_SWAP_H
Definition cholesky.hpp:10
static constexpr auto swap(XA &&a, XB &&b)
Definition swap.hpp:20
static constexpr auto range(F &&f, Xs &&...args)
Definition range.hpp:18