4242#include < hydra/detail/CompositeTraits.h>
4343#include < hydra/Parameter.h>
4444#include < hydra/Tuple.h>
45+ #include < type_traits>
4546
4647namespace hydra {
4748
4849
4950template <typename F0, typename F1, typename ... Fs >
5051class Compose : public detail ::CompositeBase<F0, F1, Fs...>
5152{
53+
54+
55+
5256public:
5357 // tag
5458
@@ -80,11 +84,16 @@ class Compose: public detail::CompositeBase<F0, F1, Fs...>
8084 return *this ;
8185 }
8286
83- template <typename T1 >
87+ template <typename ...T >
8488 __hydra_host__ __hydra_device__
85- inline return_type operator ()(T1&& x ) const
89+ inline std::enable_if<
90+ detail::is_valid_type_pack< argument_type, T...>::value,
91+ return_type>::type
92+ operator ()( T... x ) const
8693 {
8794
95+ static_assert ( std::is_convertible< hydra::tuple<T...>, argument_type>::value, " >>>>>>>" );
96+
8897 // evaluating f(g_1(x), g_2(x), ..., g_n(x))
8998
9099 auto g = detail::dropFirst (this ->fFtorTuple );
@@ -93,7 +102,7 @@ class Compose: public detail::CompositeBase<F0, F1, Fs...>
93102
94103 typedef decltype (g) G_tuple ;
95104
96- return f (detail::invoke<G_tuple, T1>(std::forward<T1>(x), g ));
105+ return f (detail::invoke<G_tuple, hydra::tuple<T&...>>( hydra::tie (x...), g ));
97106 }
98107
99108
0 commit comments