Skip to content

Commit

Permalink
#276: active: decay tuple elements properly
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Jan 18, 2023
1 parent f7cab16 commit cb28d28
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/vt/messaging/active.h
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ struct ActiveMessenger : runtime::component::PollableComponent<ActiveMessenger>
*/
template <auto f, typename... Params>
PendingSendType send(NodeType dest, Params&&... params) {
using Tuple = typename std::decay<std::tuple<Params...>>::type;
using Tuple = DecayTuple<std::tuple<Params...>>;
using MsgT = ParamMsg<Tuple>;
auto msg = vt::makeMessage<MsgT>(std::forward<Params>(params)...);
auto han = auto_registry::makeAutoHandlerParam<decltype(f),f,Params...>();
Expand Down
8 changes: 8 additions & 0 deletions src/vt/messaging/param_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ struct ParamMsg : vt::Message {
}
};


template <typename... Params>
constexpr auto decayTypes(std::tuple<Params...> const&)
-> std::tuple<std::remove_cv_t<std::remove_reference_t<Params>>...>;

template <typename T>
using DecayTuple = decltype(decayTypes(std::declval<T>()));

}} /* end namespace vt::messaging */

#endif /*INCLUDED_VT_MESSAGING_PARAM_MSG_H*/
2 changes: 1 addition & 1 deletion src/vt/registry/auto/auto_registry_general.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ template <typename F, F f, typename... Params>
struct FunctorAdapterParam {
using FunctionPtrType = F;
using ObjType = SentinelObject;
using MsgType = messaging::ParamMsg<std::tuple<Params...>>;
using MsgType = messaging::ParamMsg<messaging::DecayTuple<std::tuple<Params...>>>;

static constexpr FunctionPtrType getFunction() { return f; }

Expand Down

0 comments on commit cb28d28

Please sign in to comment.