OpenKalman
gettable.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_COLLECTIONS_GETTABLE_HPP
17 #define OPENKALMAN_COLLECTIONS_GETTABLE_HPP
18 
20 
22 {
23 #ifndef __cpp_concepts
24  namespace detail
25  {
26  template<std::size_t i, typename T, typename = void>
27  struct gettable_impl : std::false_type {};
28 
29  template<std::size_t i, typename T>
30  struct gettable_impl<i, T,
31  std::void_t<decltype(collections::get<i>(std::declval<T&>()))>> : std::true_type {};
32  }
33 #endif
34 
35 
39  template<std::size_t i, typename T>
40 #ifdef __cpp_concepts
41  concept gettable = requires(T& t) { collections::get<i>(t); };
42 #else
43  constexpr bool gettable = detail::gettable_impl<i, T>::value;
44 #endif
45 
46 
47 }
48 
49 #endif
Namespace for collections.
Definition: collections.hpp:27
Definition for collections::get.
constexpr bool gettable
T has an element i that is accessible by collections::get.
Definition: gettable.hpp:43