pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
min.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_BASIC_FUNCTIONS_MIN_H
4#define pRC_CORE_BASIC_FUNCTIONS_MIN_H
5
9
10namespace pRC
11{
12 template<class X>
13 static inline constexpr X min(X &&a)
14 {
15 return forward<X>(a);
16 }
17
18 template<class XA, class XB, If<IsInvocable<Less, XA, XB>> = 0>
19 static inline constexpr auto min(XA &&a, XB &&b)
20 {
21 return where(a < b, forward<XA>(a), forward<XB>(b));
22 }
23
24 template<class XA, class XB, class... Xs, If<IsInvocable<Less, XA, XB>> = 0,
25 If<All<IsInvocable<Less,
27 static inline constexpr auto min(XA &&a, XB &&b, Xs &&...args)
28 {
29 return min(min(forward<XA>(a), forward<XB>(b)), forward<Xs>(args)...);
30 }
31}
32#endif // pRC_CORE_BASIC_FUNCTIONS_MIN_H
Definition cholesky.hpp:18
std::conjunction< Bs... > All
Definition type_traits.hpp:77
static constexpr X min(X &&a)
Definition min.hpp:13
std::enable_if_t< B{}, int > If
Definition type_traits.hpp:68
std::is_invocable< F, Args... > IsInvocable
Definition type_traits.hpp:134
static constexpr T where(TE const e, T &&a, T &&b)
Definition where.hpp:12
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13