1010// ----------------------------------------------------------------------------
1111
1212namespace beman ::execution26::detail {
13- template <::std::size_t , typename T>
13+
14+ template <::std::size_t I, typename T>
1415struct product_type_element {
1516 T value;
1617 auto operator ==(const product_type_element&) const -> bool = default ;
@@ -23,6 +24,7 @@ template <::std::size_t... I, typename... T>
2324struct product_type_base <::std::index_sequence<I...>, T...>
2425 : ::beman::execution26::detail::product_type_element<I, T>... {
2526 static constexpr ::std::size_t size () { return sizeof ...(T); }
27+ static constexpr bool is_product_type{true };
2628
2729 template <::std::size_t J, typename S>
2830 static auto element_get (::beman::execution26::detail::product_type_element<J, S>& self) noexcept -> S& {
@@ -64,6 +66,10 @@ struct product_type_base<::std::index_sequence<I...>, T...>
6466 auto operator ==(const product_type_base&) const -> bool = default ;
6567};
6668
69+ template <typename T>
70+ concept is_product_type_c = requires (T const & t){ T::is_product_type; };
71+
72+
6773template <typename ... T>
6874struct product_type : ::beman::execution26::detail::product_type_base<::std::index_sequence_for<T...>, T...> {
6975 template <typename Allocator, typename Product, std::size_t ... I>
@@ -108,13 +114,16 @@ constexpr auto is_product_type(const ::beman::execution26::detail::product_type<
108114} // namespace beman::execution26::detail
109115
110116namespace std {
111- template <typename ... T>
112- struct tuple_size <::beman::execution26::detail::product_type<T...>>
113- : ::std::integral_constant<std::size_t , sizeof ...(T)> {};
114- template <::std::size_t I, typename ... T>
115- struct tuple_element <I, ::beman::execution26::detail::product_type<T...>> {
117+ template <typename T>
118+ requires ::beman::execution26::detail::is_product_type_c<T>
119+ struct tuple_size <T>
120+ : ::std::integral_constant<std::size_t , T::size()> {};
121+
122+ template <::std::size_t I, typename T>
123+ requires ::beman::execution26::detail::is_product_type_c<T>
124+ struct tuple_element <I, T> {
116125 using type =
117- ::std::decay_t <decltype (::std::declval<::beman::execution26::detail::product_type<T...> >().template get<I>())>;
126+ ::std::decay_t <decltype (::std::declval<T >().template get<I>())>;
118127};
119128} // namespace std
120129
0 commit comments