views:

147

answers:

0

Hi experts,

The following codes compiled and linked fine with g++-4.0 on a Mac OSX

for_each(As.begin(), As.end(),
    boost::lambda::if_then(
     boost::lambda::bind(&A::get_string, boost::lambda::_1)==" CA ", 
     boost::lambda::bind(&std::list<A>::push_back, &As_copy, boost::lambda::_1)
    )
);

But when I try to populate a container of const reference of A,

 for_each(As.begin(), As.end(),
        boost::lambda::if_then(
         boost::lambda::bind(&A::get_string, boost::lambda::_1)==" CA ", 
         boost::lambda::bind(&std::list<const A*>::push_back, &As_ref_copy, &boost::lambda::_1)
        )
    );

it failed with

Undefined symbols: std::list< ... >::push_back(A const* const&)", referenced from:...o ld: symbol(s) not found

Is there a remedy? Thanks.