OpenKalman
size.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_VALUES_SIZE_HPP
17 #define OPENKALMAN_VALUES_SIZE_HPP
18 
19 #include <type_traits>
20 #include "index.hpp"
21 
22 namespace OpenKalman::values
23 {
28  {
29  friend constexpr bool operator==(unbounded_size_t, unbounded_size_t) noexcept { return true; }
30 
31 #ifdef __cpp_concepts
32  template<index T>
33 #else
34  template<typename T, std::enable_if_t<index<T>, int> = 0>
35 #endif
36  friend constexpr bool operator==(unbounded_size_t, const T&) noexcept { return false; }
37 
38 #ifndef __cpp_lib_three_way_comparison
39 #ifdef __cpp_concepts
40  template<index T>
41 #else
42  template<typename T, std::enable_if_t<index<T>, int> = 0>
43 #endif
44  friend constexpr bool operator==(const T&, unbounded_size_t) noexcept { return false; }
45 #endif
46  };
47 
48 
49 
50 
54  inline constexpr unbounded_size_t unbounded_size {};
55 
56 
60 #ifdef __cpp_concepts
61  template<typename T>
62  concept size =
63 #else
64  template<typename T>
65  constexpr bool size =
66 #endif
67  index<T> or stdex::same_as<std::decay_t<T>, unbounded_size_t>;
68 
69 
70 }
71 
72 #endif
Definition for values::index.
A type reflecting an unbound size.
Definition: size.hpp:27
constexpr bool size
T is either an index representing a size, or unbounded_size_t, which indicates that the size is unbou...
Definition: size.hpp:65
Definition for values::abs.
Definition: fixed-constants.hpp:23
constexpr unbounded_size_t unbounded_size
An instance of unbounded_size_t;.
Definition: size.hpp:54