Boost logo

Boost Users :

Subject: [Boost-users] [variant] apply templated visitor
From: Dmitry Vinogradov (sraider_at_[hidden])
Date: 2009-05-20 16:19:48

Imagine the following:

struct foo
   bar& operator[](int);
   bar& operator[](std::string);
} Foo;

boost::variant<int, std::string> 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

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at