Hi list.
I've got a question on calling map::insert using bind. What I'd like to
do is to copy all members in m into m2:
#include <iostream>
#include <algorithm>
#include <map>
#include <utility>
#include
#include
#include
using namespace std;
using namespace boost::lambda;
int main()
{
map m;
map m2;
m["a"] = 1;
m["b"] = 2;
m2["c"] = 3;
for_each(m.begin(), m.end(),
bind(&map::insert, &m2,
bind(&make_pair,
bind(&map::value_type::first, _1),
bind(&map::value_type::second, _1))));
return EXIT_SUCCESS;
}
Unfortunately, the above code fails to compile and I have no idea
why it fails. I'm using g++ and the errors are as follows:
g++ map_test.cpp
map_test.cpp: In function 'int main()':
map_test.cpp:26: error: no matching function for call to 'bind(<unknown
type>, const
boost::lambda::lambda_functor >,
boost::tuples::tuple std::pair, int>::* const, const
boost::lambda::lambda_functor >,
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> > >, const
boost::lambda::lambda_functor >,
boost::tuples::tuple, int>::* const, const
boost::lambda::lambda_functor >,
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> > >)'
Any idea on this?
Sincerely,
Minkoo Seo
--
View this message in context: http://www.nabble.com/calling-map%3A%3Ainsert-through-bind.-tf2150829.html#a...
Sent from the Boost - Users forum at Nabble.com.