OpenKalman
has_static_strides.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) 2022-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 
17 #ifndef OPENKALMAN_HAS_STATIC_STRIDES_HPP
18 #define OPENKALMAN_HAS_STATIC_STRIDES_HPP
19 
20 namespace OpenKalman::internal
21 {
22  namespace detail
23  {
24  template<typename Strides, std::size_t...ix>
25  constexpr bool has_static_strides_i(std::index_sequence<ix...>)
26  {
27  return (values::fixed<std::tuple_element_t<ix, Strides>> and ...);
28  };
29 
30  template<typename Strides>
31  constexpr bool has_static_strides_impl()
32  {
33  return has_static_strides_i<Strides>(std::make_index_sequence<std::tuple_size_v<Strides>>{});
34  };
35  }
36 
37 
41  template<typename T>
42 #ifdef __cpp_concepts
43  concept has_static_strides =
44 #else
45  constexpr bool has_static_strides =
46 #endif
47  detail::has_static_strides_impl<decltype(internal::strides(std::declval<T>()))>();
48 
49 
50 } // namespace OpenKalman::internal
51 
52 #endif //OPENKALMAN_HAS_STATIC_STRIDES_HPP
constexpr bool has_static_strides
Specifies that T has strides that are known at compile time.
Definition: has_static_strides.hpp:45
constexpr bool fixed
T is a values::value that is determinable at compile time.
Definition: fixed.hpp:60
Definition: basics.hpp:48