AMDG On 03/10/2015 11:24 AM, Mathias Gaunard wrote:
How about something like this:
any a; duck_visit(f, a);
with 'f' a polymorphic function object constrained with SFINAE.
This isn't quite going to work be itself. SFINAE
doesn't actually matter as there's no way to make
duck_visit work without calling register_
if f(a) is callable for the dynamic type of a, then call it, otherwise raise an exception.
It's a start. Of course, there's no reason to limit it to one argument: any a, b, c; duck_visit(f, a, b, c); As a matter of fact, I already have a function named call which looks a lot like this, except that it dispatches using the arguments' vtables. The only real difficulty is how to integrate it into my existing framework. In Boost.TypeErasure, any is a class template. Handling the arguments isn't a problem, but what is the return type of duck_visit? In Christ, Steven Watanabe