using this link on boost website, I am able to compile the code here. and even get the answer (example). But when I do the same by defining in a class, I get the error as follow
This:
boost::const_associative_property_map< std::map<std::string, std::string> > address_map(name2address);
declares a variable and initialize it by calling the constructor with name2address. You cannot do it in a class declaration you have to do it in the class ctor :
class Test{
std::map<std::string, std::string> name2address;
boost::const_associative_property_map< std::map<std::string, std::string> >
address_map;
public:
Test() : address_map(name2address) {}
};
This should solve the compilation issue, but I'm not sure it is the best possible layout depending on how you will use Test after that.