This question is inspired in the following solution to multiple inheritance overloading pseudo-ambiguity, which is a nice way to implement lambda visitors for boost::variant as proposed in this answer:
I want to do something like the following:
template <typename ReturnType, typename... Lambdas>
struct lambda_visitor : public boost::static_visitor<ReturnType>, public Lambdas... {
using Lambdas...::operator(); //<--- doesn't seem to work
lambda_visitor(Lambdas... lambdas) : boost::static_visitor<ReturnType>() , Lambdas(lambdas)... { }
};
I'm not sure what would be the right syntax of adding using clauses for packed type lists. The using
clause is crucial to stop the compiler from complaining that the operator()
are ambiguous, which totally are not, because they have all different signatures.