Skip to content

Commit ee88bc7

Browse files
committed
Fixed Transform.
1 parent 1d1b58c commit ee88bc7

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

include/react/Event.h

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -452,34 +452,36 @@ auto operator&(TEvents&& src, F&& filter)
452452
template
453453
<
454454
typename D,
455-
typename E,
455+
typename EIn,
456456
typename FIn,
457457
typename F = std::decay<FIn>::type,
458-
typename TOp = REACT_IMPL::EventTransformOp<E,F,
459-
REACT_IMPL::EventStreamNodePtrT<D,E>>
458+
typename EOut = std::result_of<F(EIn)>::type,
459+
typename TOp = REACT_IMPL::EventTransformOp<EIn,F,
460+
REACT_IMPL::EventStreamNodePtrT<D,EIn>>
460461
>
461-
auto Transform(const Events<D,E>& src, FIn&& func)
462-
-> TempEvents<D,E,TOp>
462+
auto Transform(const Events<D,EIn>& src, FIn&& func)
463+
-> TempEvents<D,EOut,TOp>
463464
{
464-
return TempEvents<D,E,TOp>(
465-
std::make_shared<REACT_IMPL::EventOpNode<D,E,TOp>>(
465+
return TempEvents<D,EOut,TOp>(
466+
std::make_shared<REACT_IMPL::EventOpNode<D,EOut,TOp>>(
466467
std::forward<FIn>(func), src.NodePtr()));
467468
}
468469

469470
template
470471
<
471472
typename D,
472-
typename E,
473+
typename EIn,
473474
typename TOpIn,
474475
typename FIn,
475476
typename F = std::decay<FIn>::type,
476-
typename TOpOut = REACT_IMPL::EventTransformOp<E,F,TOpIn>
477+
typename EOut = std::result_of<F(EIn)>::type,
478+
typename TOpOut = REACT_IMPL::EventTransformOp<EIn,F,TOpIn>
477479
>
478-
auto Transform(TempEvents<D,E,TOpIn>&& src, FIn&& func)
479-
-> TempEvents<D,E,TOpOut>
480+
auto Transform(TempEvents<D,EIn,TOpIn>&& src, FIn&& func)
481+
-> TempEvents<D,EOut,TOpOut>
480482
{
481-
return TempEvents<D,E,TOpOut>(
482-
std::make_shared<REACT_IMPL::EventOpNode<D,E,TOpOut>>(
483+
return TempEvents<D,EOut,TOpOut>(
484+
std::make_shared<REACT_IMPL::EventOpNode<D,EOut,TOpOut>>(
483485
std::forward<FIn>(func), src.StealOp()));
484486
}
485487

0 commit comments

Comments
 (0)