OpenKalman
common_tuple_type.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_COMMON_TUPLE_TYPE_HPP
17 #define OPENKALMAN_COLLECTIONS_COMMON_TUPLE_TYPE_HPP
18 
20 
22 {
23  namespace detail
24  {
25  template<typename Tup, typename = std::make_index_sequence<std::tuple_size_v<Tup>>>
27 
28 
29  template<typename Tup, std::size_t...ix>
30  struct common_tuple_type_impl<Tup, std::index_sequence<ix...>>
31 #if __cplusplus >= 202002L
32  : std::common_reference<std::tuple_element_t<ix, std::decay_t<Tup>>...> {};
33 #else
34  : std::common_type<std::tuple_element_t<ix, std::decay_t<Tup>>...> {};
35 #endif
36  }
37 
38 
42 #ifdef __cpp_concepts
43  template<tuple_like T>
44  struct common_tuple_type
45 #else
46  template<typename T, typename = void>
48 
49  template<typename T>
50  struct common_tuple_type<T, std::enable_if_t<tuple_like<T>>>
51 #endif
52  : detail::common_tuple_type_impl<std::decay_t<T>> {};
53 
54 
58  template<typename T>
60 
61 
62 } // namespace OpenKalman
63 
64 #endif //OPENKALMAN_COLLECTIONS_COMMON_TUPLE_TYPE_HPP
Definition for collections::tuple_like.
Namespace for collections.
Definition: collections.hpp:27
typename common_tuple_type< T >::type common_tuple_type_t
Helper template for common_collection_type.
Definition: common_tuple_type.hpp:59
Definition: tuple_reverse.hpp:103
The common type within a tuple_like object, if it exists.
Definition: common_tuple_type.hpp:47