|
Boost Users : |
From: jll_at_[hidden]
Date: 2005-08-20 04:07:32
Hello,
I'm just discovering Boost, and it looks great. However, I can't get
the following code to work. I use g++ (GCC) 3.4.4 20050721 and boost
1.32 (also tried 1.33). When I try a similar example with mere
integers it works though...
#include <string>
#include <sstream>
#include <iterator>
#include <vector>
#include <boost/lambda/bind.hpp>
#include <boost/lambda/lambda.hpp>
using namespace std;
using namespace boost::lambda;
int main() {
vector<string> cols;
cols.push_back("foo");
string prefix = "t1.";
for_each(cols.begin(), cols.end(), _1 = prefix + _1);
cout << cols.front() << endl;
return 0;
}
g++ t.cpp && ./a.out
/usr/include/boost/lambda/detail/operator_lambda_func_base.hpp: In member function `RET boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, Args>::call(A&, B&, C&, Env&) const [with RET = std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, A = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, B = const boost::tuples::null_type, C = const boost::tuples::null_type, Env = const boost::tuples::null_type, Args = boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, 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, 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>]':
/usr/include/boost/lambda/detail/lambda_functors.hpp:146: instantiated from `typename T::sig<boost::tuples::tuple<A&, 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> >::type boost::lambda::lambda_functor<Base>::operator()(A&) const [with A = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, T = boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, b
oost::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, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >]'
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/stl_algo.h:158: instantiated from `_Function std::for_each(_InputIterator, _InputIterator, _Function) [with _InputIterator = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Function = boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, 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, boost::tuples::null_type, boos
t::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > >]'
t.cpp:16: instantiated from here
/usr/include/boost/lambda/detail/operator_lambda_func_base.hpp:237: error: no match for 'operator=' in 'boost::lambda::detail::select [with Arg = boost::lambda::placeholder<1>, A = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, B = const boost::tuples::null_type, C = const boost::tuples::null_type, Env = const boost::tuples::null_type](((const boost::lambda::lambda_functor<boost::lambda::placeholder<1> >&)(+boost::tuples::get [with int N = 0, HT = boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, TT = boost::tuples::cons<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, 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>](((const boost::tuples::cons<boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::cons<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, 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> >&)((const boost::tuples::cons<boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::cons<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tu
ples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > >, boost::tuples::null_type> >*)((const boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, 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, 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>*)this)))))), ((std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)(+a)), ((const boost::tuples::null_typ
e&)(+b)), ((const boost::tuples::null_type&)(+c)), ((const boost::tuples::null_type&)(+env))) = boost::lambda::detail::select [with Arg = boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, 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> >, A = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, B = const boost::tuples::null_type, C = const boost::tuples::null_type, Env = const boost::tuples::null_type](((const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, 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::get [with int N = 1, HT = boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, TT = boost::tuples::cons<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, 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>](((const boost::tuples::cons<boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::cons<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<
const std::string, 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> >&)((const boost::tuples::cons<boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::cons<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, 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> >*)((const boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::lambda::lambda_fu
nctor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, 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, 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>*)this)))))), ((std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)(+a)), ((const boost::tuples::null_type&)(+b)), ((const boost::tuples::null_type&)(+c)), ((const boost::tuples::null_type&)(+env)))'
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:426: note: candidates are: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:437: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:451: note: std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]
/usr/include/boost/lambda/detail/operator_lambda_func_base.hpp: In member function `RET boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, Args>::call(A&, B&, C&, Env&) const [with RET = boost::lambda::detail::return_type_deduction_failure<boost::lambda::detail::return_type_2_arithmetic_phase_3<std::string, std::string> >, A = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, B = const boost::tuples::null_type, C = const boost::tuples::null_type, Env = const boost::tuples::null_type, Args = boost::tuples::tuple<const std::string, 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>]':
/usr/include/boost/lambda/detail/select_functions.hpp:28: instantiated from `typename Arg::sig<boost::tuples::tuple<A&, B&, C&, Env&, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >::type boost::lambda::detail::select(const boost::lambda::lambda_functor<T>&, A&, B&, C&, Env&) [with Arg = boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, 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> >, A = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, B = const boost::tuples::null_type, C = const boost::tuples::null_type, Env = const boost::tuples::null_type]'
/usr/include/boost/lambda/detail/operator_lambda_func_base.hpp:237: instantiated from `RET boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, Args>::call(A&, B&, C&, Env&) const [with RET = std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, A = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, B = const boost::tuples::null_type, C = const boost::tuples::null_type, Env = const boost::tuples::null_type, Args = boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, 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_ty
pe> > >, 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>]'
/usr/include/boost/lambda/detail/lambda_functors.hpp:146: instantiated from `typename T::sig<boost::tuples::tuple<A&, 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> >::type boost::lambda::lambda_functor<Base>::operator()(A&) const [with A = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, T = boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, b
oost::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, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >]'
/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/stl_algo.h:158: instantiated from `_Function std::for_each(_InputIterator, _InputIterator, _Function) [with _InputIterator = __gnu_cxx::__normal_iterator<std::string*, std::vector<std::string, std::allocator<std::string> > >, _Function = boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::other_action<boost::lambda::assignment_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::plus_action>, boost::tuples::tuple<const std::string, 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, boost::tuples::null_type, boos
t::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > >]'
t.cpp:16: instantiated from here
/usr/include/boost/lambda/detail/operator_lambda_func_base.hpp:206: error: conversion from `std::basic_string<char, std::char_traits<char>, std::allocator<char> >' to non-scalar type `boost::lambda::detail::return_type_deduction_failure<boost::lambda::detail::return_type_2_arithmetic_phase_3<std::string, std::string> >' requested
-- Jean-Louis Leroy Sound Object Logic http://www.soundobjectlogic.com
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