
3 Feb
2009
3 Feb
'09
9:45 a.m.
The following code crashes in for_each when trying to output the 1st pair. What's wrong with it? Thanks! namespace bl = boost::lambda; std::map<std::string, std::string> temp; temp["a"] = "1"; temp["b"] = "2"; const std::map<std::string, std::string> attrs(temp); typedef std::pair<std::string, std::string> string_pair; std::stringstream stream; std::for_each(attrs.begin(), attrs.end(), stream << bl::bind(&string_pair::first, bl::_1) << bl::bind(&string_pair::second, bl::_1));