Skip to content

Commit 0b20ab0

Browse files
committed
...
1 parent bf85b59 commit 0b20ab0

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Bug fixes:
1212

1313
2) Covering composite of composites (https://github.com/MultithreadCorner/Hydra/issues/100)
1414

15+
3) Covering caching for parameterless functors.
16+
1517

1618
### Hydra 3.2.1
1719

hydra/detail/Compose.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,17 @@
4242
#include <hydra/detail/CompositeTraits.h>
4343
#include <hydra/Parameter.h>
4444
#include <hydra/Tuple.h>
45+
#include <type_traits>
4546

4647
namespace hydra {
4748

4849

4950
template<typename F0, typename F1, typename... Fs >
5051
class Compose: public detail::CompositeBase<F0, F1, Fs...>
5152
{
53+
54+
55+
5256
public:
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

hydra/detail/CompositeBase.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <hydra/detail/Constant.h>
4040
#include <hydra/Parameter.h>
4141
#include <hydra/Placeholders.h>
42+
#include <hydra/detail/TupleTraits.h>
4243

4344
namespace hydra {
4445

@@ -48,8 +49,11 @@ template<typename F0, typename F1, typename... Fs >
4849
class CompositeBase
4950
{
5051

52+
53+
5154
public:
5255

56+
typedef typename hydra::detail::merged_tuple<typename F1::argument_type>::type argument_type;
5357
typedef typename hydra_thrust::tuple<F0, F1, Fs...> functors_type;
5458

5559
//tag

0 commit comments

Comments
 (0)