I am trying to use boost::bind
and STL with boost::tuple
, but each time I try to compile I get the following error.
error: call of overloaded ‘bind(<unresolved overloaded function type>,
boost::arg<1>&)’ is ambiguous
Do you know what I am doing wrong here and why is only for the boost::arg<1>
?
Thanks AFG
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <boost/tuple/tuple.hpp>
#include <boost/assign.hpp>
#include <boost/bind.hpp>
int main( int argc, const char** argv ){
using namespace boost::assign;
typedef boost::tuple< int, double > eth_array;
std::vector< eth_array > v;
v+= boost::make_tuple( 10,23.4), boost::make_tuple( 12,24.4) );
std::for_each( v.begin()
, v.end()
, boost::bind<int>(
printf
, "%d-%f"
, boost::bind( eth_array::get<0>, _1 )
, boost::bind( eth_array::get<1>, _1 )
)
);