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 
21 
22 namespace OpenKalman
23 {
24  namespace detail
25  {
26  template<typename T, std::size_t...is>
27  constexpr auto
28  empty_object_fixed_index_count(std::index_sequence<is...>)
29  {
30  return (... or (dimension_size_of_index_is<T, is, 0>));
31  }
32 
33 
34 #ifndef __cpp_concepts
35  template<typename T, std::enable_if_t<indexible<T>, int> = 0>
36  constexpr auto
37  empty_object_impl()
38  {
39  return detail::empty_object_fixed_index_count<T>(std::make_index_sequence<index_count_v<T>>{});
40  }
41 #endif
42  }
43 
44 
48  template<typename T>
49 #ifdef __cpp_concepts
50  concept empty_object =
51  indexible<T> and
52  detail::empty_object_fixed_index_count<T>(std::make_index_sequence<index_count_v<T>>{});
53 #else
54  constexpr inline bool empty_object = detail::empty_object_impl<T>();
55 #endif
56 
57 
58 }
59 
60 #endif
constexpr bool empty_object
Specifies that an object is empty (i.e., at least one index is zero-dimensional). ...
Definition: empty_object.hpp:54
Definition for dimension_size_of_index_is.
The root namespace for OpenKalman.
Definition: basics.hpp:34
Definition for index_count.
Definition: trait_backports.hpp:64