OpenKalman
greater.hpp
Go to the documentation of this file.
1 /* This file is part of OpenKalman, a header-only C++ library for
2  * Kalman filters and other recursive filters.
3  *
4  * Copyright (c) 2025 Christopher Lee Ogden <ogden@gatech.edu>
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
9  */
10 
16 #ifndef OPENKALMAN_GREATER_HPP
17 #define OPENKALMAN_GREATER_HPP
18 
19 #include <utility>
22 
23 namespace OpenKalman
24 {
28  template<typename T = void>
29  struct greater
30  {
31 #if defined(__cpp_static_call_operator) and __cplusplus >= 202002L
32  static constexpr bool operator()(const T& lhs, const T& rhs)
33 #else
34  constexpr bool operator()(const T& lhs, const T& rhs) const
35 #endif
36  {
37  return lhs > rhs;
38  }
39  };
40 
41 
45  template<>
46  struct greater<void>
47  {
48  template<typename Lhs, typename Rhs>
49 #if defined(__cpp_static_call_operator) and __cplusplus >= 202002L
50  static constexpr bool operator()(const Lhs& lhs, const Rhs& rhs)
51 #else
52  constexpr bool operator()(const Lhs& lhs, const Rhs& rhs) const
53 #endif
54  {
55  using namespace std;
56  if constexpr (is_arithmetic_v<Lhs> and is_arithmetic_v<Rhs>)
57  return cmp_greater(lhs, rhs);
58  else
59  return lhs > rhs;
60  }
61  };
62 
63 } // namespace OpenKalman
64 
65 #endif //OPENKALMAN_GREATER_HPP
A generalization of std::greater in which the arguments may be of different types.
Definition: greater.hpp:29
Definition: tuple_reverse.hpp:103
The root namespace for OpenKalman.
Definition: basics.hpp:34
Definitions relating to the availability of c++ language features.
Global definitions for OpenKalman.