OpenKalman
uniform_tuple_like.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_UNIFORM_TUPLE_LIKE_HPP
17 #define OPENKALMAN_COLLECTIONS_UNIFORM_TUPLE_LIKE_HPP
18 
21 
23 {
24 #ifndef __cpp_lib_ranges
25  namespace detail
26  {
27  template<typename T, typename = void>
28  struct has_common_tuple_type : std::false_type {};
29 
30  template<typename T>
31  struct has_common_tuple_type<T, std::void_t<typename common_tuple_type<T>::type>> : std::true_type {};
32  }
33 #endif
34 
35 
39  template<typename T>
40 #ifdef __cpp_lib_ranges
41  concept uniform_tuple_like = tuple_like<T> and (size_of_v<T> == 0 or requires { typename common_tuple_type<T>::type; });
42 #else
43  constexpr bool uniform_tuple_like = tuple_like<T> and (size_of_v<T> == 0 or detail::has_common_tuple_type<T>::value);
44 #endif
45 
46 
47 } // namespace OpenKalman
48 
49 #endif //OPENKALMAN_COLLECTIONS_UNIFORM_TUPLE_LIKE_HPP
Namespace for collections.
Definition: collections.hpp:27
Definition: tuple_reverse.hpp:103
Definition for collections::size_of.
Definition: uniform_tuple_like.hpp:28
Definition for collections::common_tuple_type.
constexpr bool uniform_tuple_like
A tuple_like object that has a common_collection_type.
Definition: uniform_tuple_like.hpp:43
The common type within a tuple_like object, if it exists.
Definition: common_tuple_type.hpp:47