pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
max.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_BASIC_FUNCTIONS_MAX_H
4#define pRC_CORE_BASIC_FUNCTIONS_MAX_H
5
9
10namespace pRC
11{
12 template<class X>
13 static inline constexpr X max(X &&a)
14 {
15 return forward<X>(a);
16 }
17
18 template<class XA, class XB, If<IsInvocable<Greater, XA, XB>> = 0>
19 static inline constexpr auto max(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,
26 If<All<IsInvocable<Greater,
28 static inline constexpr auto max(XA &&a, XB &&b, Xs &&...args)
29 {
30 return max(max(forward<XA>(a), forward<XB>(b)), forward<Xs>(args)...);
31 }
32}
33#endif // pRC_CORE_BASIC_FUNCTIONS_MAX_H
Definition cholesky.hpp:18
std::conjunction< Bs... > All
Definition type_traits.hpp:77
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
static constexpr X max(X &&a)
Definition max.hpp:13