pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
less.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_VALUE_FUNCTIONS_LESS_H
4#define pRC_CORE_VALUE_FUNCTIONS_LESS_H
5
8
9namespace pRC
10{
22 template<class TA, class TB, If<IsValue<TA>> = 0, If<IsValue<TB>> = 0,
23 If<Any<IsFloat<TA>, IsFloat<TB>>> = 0>
24 static inline constexpr auto operator<(TA const &a, TB const &b)
25 {
26 return a() < b();
27 }
28
38 template<class TA, class TB, If<IsInteger<TA>> = 0, If<IsInteger<TB>> = 0>
39 static inline constexpr auto operator<(TA const &a, TB const &b)
40 {
41 if constexpr(typename TA::Signed() == typename TB::Signed())
42 {
43 return a() < b();
44 }
45 else
46 {
47 if constexpr(typename TA::Signed() == true)
48 {
49 using UA = typename TA::template ChangeSigned<false>;
50 return a < zero() ? true : UA(a) < b;
51 }
52 else
53 {
54 using UB = typename TB::template ChangeSigned<false>;
55 return b < zero() ? false : a < UB(b);
56 }
57 }
58 }
59}
60#endif // pRC_CORE_VALUE_FUNCTIONS_LESS_H
Definition cholesky.hpp:18
static constexpr auto operator<(X &&a, Zero<> const)
Definition less.hpp:12
static constexpr auto zero()
Definition zero.hpp:12
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13