OpenKalman
empty_object.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) 2019-2023 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_EMPTY_OBJECT_HPP
17 #define OPENKALMAN_EMPTY_OBJECT_HPP
18 
19 
20 namespace OpenKalman
21 {
22  namespace detail
23  {
24  template<typename T, Applicability b, std::size_t...Ix>
25  constexpr bool has_0_dim(std::index_sequence<Ix...>)
26  {
27  return (dimension_size_of_index_is<T, Ix, 0, b> or ...);
28  }
29  } // namespace detail
30 
31 
35  template<typename T, Applicability b = Applicability::guaranteed>
36 #ifdef __cpp_concepts
37  concept empty_object =
38 #else
39  constexpr bool empty_object =
40 #endif
41  indexible<T> and (index_count_v<T> != dynamic_size or b != Applicability::guaranteed) and
42  (index_count_v<T> == dynamic_size or detail::has_0_dim<T, b>(std::make_index_sequence<index_count_v<T>>{}));
43 
44 
45 } // namespace OpenKalman
46 
47 #endif //OPENKALMAN_EMPTY_OBJECT_HPP
The root namespace for OpenKalman.
Definition: basics.hpp:34
Applicability
The applicability of a concept, trait, or restraint.
Definition: global-definitions.hpp:93
constexpr std::size_t dynamic_size
A constant indicating that a size or index is dynamic.
Definition: global-definitions.hpp:33
constexpr bool empty_object
Specifies that an object is empty (i.e., at least one index is zero-dimensional). ...
Definition: empty_object.hpp:39
The concept, trait, or restraint represents a compile-time guarantee.