Boost logo

Boost Users :

From: Moyukh (moyukh_at_[hidden])
Date: 2008-01-09 14:33:26


I was using boost::bind with boost::tuple as shown in the code snippet below.
This piece of code compiles and executes fine in Visual Studio 2005
but while compiling with gcc-4.1 It throws error "unresolved
overloaded function type"
(This code actually does nothing except reproduce the error)

I guess its because gcc was unable to figure out which get() to call
as there are two
version const and non const.

Any suggestion how to make it work with gcc as well as VS2005.

Code
----------------

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

int main(int argc, char * argv[])
{
       typedef boost::tuple<int, bool, int > myTuple;

       myTuple mt;
       boost::bind(&myTuple::get<0>, _1)(mt);

       return 0;
}

gcc error..
--------------------

Test.cpp: In function 'int main(int, char**)':
Test.cpp:13: error: call of overloaded 'bind(<unresolved overloaded
function type>, boost::arg<1> (&)())' is ambiguous
../../../../../Boost/boost/bind/bind_mf_cc.hpp:20: note: candidates
are: boost::_bi::bind_t<R, boost::_mfi::mf0<R, T>, typename
boost::_bi::list_av_1<A1>::type> boost::bind(R (T::*)(), A1) [with R =
int&, T = boost::tuples::cons<int, boost::tuples::cons<bool,
boost::tuples::cons<int, boost::tuples::null_type> > >, A1 =
boost::arg<1> (*)()]
../../../../../Boost/boost/bind/bind_mf_cc.hpp:30: note:
 boost::_bi::bind_t<R, boost::_mfi::cmf0<R, T>, typename
boost::_bi::list_av_1<A1>::type> boost::bind(R (T::*)()const, A1)
[with R = const int&, T = boost::tuples::cons<int,
boost::tuples::cons<bool, boost::tuples::cons<int,
boost::tuples::null_type> > >, A1 = boost::arg<1> (*)()]

Thanks
    Moyukh


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