OpenKalman
common_collection_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_COLLECTION_TYPE_HPP
17 #define OPENKALMAN_COLLECTIONS_COMMON_COLLECTION_TYPE_HPP
18 
21 
23 {
27 #ifdef __cpp_lib_ranges
28  template<collection T>
29 #else
30  template<typename T, typename = void>
31 #endif
33 
34 
35 #ifdef __cpp_lib_ranges
36  template<collection T> requires std::ranges::range<T>
37  struct common_collection_type<T>
38  {
39  using type = std::ranges::range_value_t<std::remove_cvref_t<T>>;
40  };
41 #else
42  template<typename T>
43  struct common_collection_type<T, std::enable_if_t<ranges::range<T>>>
44  {
45  using type = ranges::range_value_t<remove_cvref_t<T>>;
46  };
47 #endif
48 
49 
53  template<typename T>
55 
56 
57 } // namespace OpenKalman
58 
59 #endif //OPENKALMAN_COLLECTIONS_COMMON_COLLECTION_TYPE_HPP
Namespace for collections.
Definition: collections.hpp:27
Definition for collections::collection.
typename common_collection_type< T >::type common_collection_type_t
Helper template for common_collection_type.
Definition: common_collection_type.hpp:54
Definition: tuple_reverse.hpp:103
Definition for collections::common_tuple_type.
The common type within a collection, if it exists.
Definition: common_collection_type.hpp:32
The common type within a tuple_like object, if it exists.
Definition: common_tuple_type.hpp:47