Boost logo

Boost Users :

From: sj_at_[hidden]
Date: 2007-12-06 09:53:02


Hello,

Thanks Eric and Peter for the help with my previous question. Now I
have another question.

1.34.1 does not allow me to compile the following code (it was fine on
1.33.1):
struct CNode {void GetName(){}};
int main(int argc, char **argv){
        typedef std::map<int, CNode> TPNodes;
        TPNodes Children;
        std::for_each(
                Children.begin(),
                Children.end(),
                boost::bind(
                        &CNode::GetName,
// Problem here
                        boost::bind(&TPNodes::value_type::second,_1)));
        return 0;
}

I get this error:
error C2440: 'argument' : cannot convert from 'const CNode *__w64 ' to
'CNode *const ' c:\src\boost_1_34_1\boost\bind\mem_fn_template.hpp 35

The code works if I have a map with pointers, but if I have instances
then I have the error. It looks like I get a const value which was fine
when a pointer was used.

The question is how do I use algorithm on maps when I want to use only
key or value?

Thanks.

-- 
Regards, Alexander.           http://sjcomp.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