Boost logo

Boost :

Subject: Re: [boost] Boost::Lambda + Boost::Tuple + unresolved overloaded function type
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-05-13 12:31:10


AMDG

Dmitry V. Krivenok wrote:
> bll::bind(boost::make_tuple<int*, bool>, &bll::_1,
> true));
> ////////////////////////////////////////////////////////////////
>
> It doesn't compile:
>
> $ g++-4.3.2 -I /usr/local/dev/boost-1.38.0/include/ main2.cpp
> main2.cpp: In function 'int main()':
> main2.cpp:22: error: no matching function for call to
> 'bind(<unresolved overloaded function type>, const
> boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::addressof_action>,
> boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<1>
> >, boost::tuples::null_type, boost::tuples::null_type,
> boost::tuples::null_type, boost::tuples::null_type,
> boost::tuples::null_type, boost::tuples::null_type,
> boost::tuples::null_type, boost::tuples::null_type,
> boost::tuples::null_type> > >, bool)'
> $
>
> What's wrong in the second program?

* make_tuple is overloaded for more than 2 arguments.
* When taking the address of a function template, the compiler can
  try to deduce template parameters based on the required signature. for
example,
  static_cast<boost::tuple<int*, bool, char> >(*)(const int*&, const
bool&, const char&)>(&boost::make_tuple<int*, bool>)
  is legal and will yield a different overload of make_tuple than the
one that you intend.
* bind is a function template so it doesn't provide enough information
to resolve
    the ambiguity.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk