Boost logo

Boost Users :

Subject: [Boost-users] boost lambda and bind
From: Conoscenza Silente (abruzzoforteegentile_at_[hidden])
Date: 2009-12-18 04:36:52

Hi All
I am trying to use boost lambda for looping over a std::map to get each
element and
pass those to a class function using lambda functions.
I don't know why but the binding inside my std::for_each is not compiling
and I have 2 errors
pointing to the line where boost::assign is used.

'invalid initialization of reference of type int&'
'invalid initialization of reference of type std::basic_string<>&'

Do you know how to fix this and why it is happening
Thank you very much



class CInnerClassHandler{
        void DoSomething( int aIntValue, const std::string& aStringValue ){

            std::cout << "INT:" << aIntValue
                        << "STRING:" << aStringValue
                        << std::endl; // here we just trace

void map_lambda_test(){

        typedef std::pair< int, std::string > this_pair;

        std::map< int, std::string > dictionary =
            boost::assign::map_list_of(3,"A")(4,"B")(5,"C"); // Errors
points to
        // this line of code

        CInnerClassHandler obj;

                    &CInnerClassHandler::DoSomething, &obj,


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at