[variant] apply templated visitor

Imagine the following:
struct foo
{
bar& operator[](int);
bar& operator[](std::string);
} Foo;
boost::variant

AMDG Dmitry Vinogradov wrote:
Imagine the following:
struct foo { bar& operator[](int); bar& operator[](std::string); } Foo;
boost::variant
Idx; Is some simple way exist to apply foo::operator[](T) for Foo and Idx?
Something like boost::apply_visitor(boost::bind(&foo::operator[], boost::ref(Foo), _1), Idx); // does not compile
You can either use a combination of bind and lambda: (untested)
boost::bind
participants (2)
-
Dmitry Vinogradov
-
Steven Watanabe