Boost logo

Boost Users :

Subject: Re: [Boost-users] [variant] apply_visitor and bind
From: Olivier Tournaire (olitour_at_[hidden])
Date: 2010-06-21 14:25:36


I finally found the solution :

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

Regards,

Olivier

2010/6/21 Olivier Tournaire <olitour_at_[hidden]>

> 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
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net