Boost logo

Boost :

Subject: [boost] Boost::Lambda + Boost::Tuple + unresolved overloaded function type
From: Dmitry V. Krivenok (krivenok_at_[hidden])
Date: 2009-05-13 12:02:51


Hello!

I wrote two simple examples to demonstrate the problem.
First one is:
////////////////////////////////////////////////////////////////
#include <vector>
#include <utility>
#include <algorithm>
#include <cassert>

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

int main()
{
  std::vector<int> v1;
  v1.push_back(1);
  v1.push_back(2);
  v1.push_back(3);
  std::vector<std::pair<int*, bool> > v2;
  namespace bll = boost::lambda;
  std::transform(v1.begin(),
                 v1.end(),
                 std::back_inserter(v2),
                 bll::bind(std::make_pair<int*, bool>, &bll::_1, true));
  assert(v2.size() == 3);

  return 0;
}
////////////////////////////////////////////////////////////////

This program compiles and works fine.

The second program is:
////////////////////////////////////////////////////////////////
#include <vector>
#include <utility>
#include <algorithm>
#include <cassert>

#include <boost/tuple/tuple.hpp>

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

int main()
{
  std::vector<int> v1;
  v1.push_back(1);
  v1.push_back(2);
  v1.push_back(3);
  namespace bll = boost::lambda;
  std::vector<boost::tuple<int*, bool> > v3;
  std::transform(v1.begin(),
                 v1.end(),
                 std::back_inserter(v3),
                 bll::bind(boost::make_tuple<int*, bool>, &bll::_1, true));
  assert(v3.size() == 3);

  return 0;
}
////////////////////////////////////////////////////////////////

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?

Thank you beforehand!

-- 
Sincerely yours, Dmitry V. Krivenok
Orange System Co., Ltd.
Saint-Petersburg, Russia
work phone: +7 812 332-32-40
cellular phone: +7 921 576-70-91
e-mail: krivenok_at_[hidden]
web: http://www.orangesystem.ru
skype: krivenok_dmitry
jabber: krivenok_dmitry_at_[hidden]
icq: 242-526-443

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