16 #ifndef OPENKALMAN_COLLECTIONS_TUPLE_LIKE_HPP 17 #define OPENKALMAN_COLLECTIONS_TUPLE_LIKE_HPP 25 #if not defined(__cpp_concepts) and __cpp_generic_lambdas < 201707L 28 template<std::
size_t i,
typename T,
typename =
void>
29 struct has_tuple_element_impl : std::false_type {};
31 template<std::
size_t i,
typename T>
32 struct has_tuple_element_impl<i, T,
std::void_t<typename std::tuple_element<i, T>::type>> : std::true_type {};
35 template<
typename T,
typename = std::make_index_sequence<collections::size_of_v<T>>>
36 struct is_tuple_like_impl : std::false_type {};
38 template<
typename T, std::size_t...i>
39 struct is_tuple_like_impl<T, std::index_sequence<i...>>
40 : std::bool_constant<(... and (gettable<i, T> and has_tuple_element_impl<i, T>::value))> {};
43 template<
typename T,
typename =
void>
44 struct is_tuple_like : std::false_type {};
47 struct is_tuple_like<T, std::void_t<decltype(std::tuple_size<T>::value)>> : is_tuple_like_impl<T> {};
58 #if defined(__cpp_concepts) and __cpp_generic_lambdas >= 201707L 60 std::tuple_size<std::decay_t<T>>
::value;
62 return (... and (gettable<i, T> and requires {
typename std::tuple_element<i, std::decay_t<T>>::type; }));
63 } (std::make_index_sequence<size_of_v<T>>{});
66 constexpr
bool tuple_like = detail::is_tuple_like<std::decay_t<T>>
::value;
Namespace for collections.
Definition: collections.hpp:27
constexpr bool value
T is a fixed or dynamic value that is reducible to a number.
Definition: value.hpp:45
Definition: trait_backports.hpp:64
Basic definitions for OpenKalman as a whole.
constexpr bool tuple_like
T is a non-empty tuple, pair, array, or other type that acts like a tuple.
Definition: tuple_like.hpp:66