cMHN 1.1
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, class RA = RemoveReference<XA>,
14 class RB = RemoveReference<XB>, If<IsTensorish<RA>> = 0,
15 If<IsInvocable<View, XA>> = 0, If<IsTensorish<RB>> = 0,
16 If<IsInvocable<View, XB>> = 0,
17 If<IsSame<typename RA::Sizes, typename RB::Sizes>> = 0,
18 class EA = ResultOf<XA, typename RA::Subscripts>,
19 class EB = ResultOf<XB, typename RB::Subscripts>,
20 If<IsInvocable<Swap, EA, EB>> = 0>
21 static inline constexpr auto swap(XA &&a, XB &&b)
22 {
24 [&a, &b](auto const... indices)
25 {
26 swap(forward<XA>(a)(indices...), forward<XB>(b)(indices...));
27 });
28 }
29}
30#endif // pRC_CORE_TENSOR_FUNCTIONS_SWAP_H
Definition cholesky.hpp:18
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
static constexpr auto swap(XA &&a, XB &&b)
Definition swap.hpp:21