I finally found the solution :

boost::apply_visitor( boost::bind( foo_visitor(), _1, 2.), foo);

Regards,

Olivier


2010/6/21 Olivier Tournaire <olitour@gmail.com>
Hi all,

How could you I use bind with apply_visitor?

#include <boost/variant.hpp>
#include <boost/bind.hpp>

struct foo_visitor : public boost::static_visitor<>
{
    template <typename Type>
    result_type operator()(const Type& data, double d) const { return /**/; }
};

int main (int argc, char** argv)
{
    boost::variant<int, double> foo;
    boost::apply_visitor( boost::bind( &foo_visitor, 2.), foo); // here?
    return 0;
}

Hope you could help

Regards,

Olivier