Hi All
I'm trying to use std::vector::push_back() within a Boost.Lambda expression, but am finding it impossible
to bind correctly. Can anyone tell me what I'm doing wrong in this code?
Thanks in advance,
- Rob.
#include <vector>
#include <boost/function.hpp>
#include <boost/lambda/bind.hpp>
void f( )
{
namespace ll = boost::lambda;
using boost::function;
typedef unsigned char Id;
typedef std::vector<Id> Ids;
ll::placeholder1_type x;
Ids ids;
void ( Ids::* push_back )( const Ids::value_type & ) = & Ids::push_back;
function<void(Id)> my_push = ll::bind( push_back, ids, x ); // Line 18
(void)my_push;
}
> g++ ignore.cpp
[...lots of template instantiation errors, then...]
ignore.cpp:18: instantiated from here
/usr/include/boost/lambda/detail/actions.hpp:96: error: no matching function for call to ‘boost::lambda::function_adaptor<void (std::vector<unsigned char, std::allocator<unsigned char> >::*)(const unsigned char&)>::apply(void (std::vector<unsigned char, std::allocator<unsigned char> >::* const&)(const unsigned char&), const std::vector<unsigned char, std::allocator<unsigned char> >&, unsigned char&)’
/usr/include/boost/lambda/detail/actions.hpp:96: error: return-statement with a value, in function returning 'void'