I have a problem with ambiguity in the following code while using the apply function. It is based on the stackoverflow question here.
1) I have a helper class, because templated functions as pointers are not allowed:
template<typename TT, class...Ts>
struct selector_helper
{
static TT doSelect(Ts&&... params)
{
return iSelectable<Ts...>::select<TT>(std::forward<Ts>(params)...);
}
};
I tried to run the apply function, but run into problems. I tried following two codes but no one with success:
2.1) error: apply: none of the 2 overloads could convert all the argument types
boost::tuple<Ts...> tpl;
return apply<T, Ts...>(selector_helper<T, Ts...>::doSelect, tpl);
2.2) here I get two errors:
- Error 2 error C2782: 'Ret apply(Ret (__cdecl *)(Args...),boost::tuples::tuple &&)' : template parameter 'Args' is ambiguous
Error 3 error C2782: 'Ret apply(Ret (__cdecl *)(Args...),const boost::tuples::tuple &)' : template parameter 'Args' is ambiguous
boost::tuple<Ts...> tpl;
return apply(selector_helper<T, Ts...>::doSelect, tpl);
What did I miss?
Aucun commentaire:
Enregistrer un commentaire