Sorry, I found i use vs2008 in one of my computer.
So I can't use c++11 like:
<br /> for (auto entry : g_map) entry.second->doSomething(p1, p2);<br />
and
<br />for_each( g_map.begin(), g_map.end() [=](std::pair<int, std::shared_ptr<TEST>> const &foo){ foo.second->doSomething(p1, p2); } );<br />
And I want use boost::bind to solute this problem.
At first, I want to bind member variables std::pair<int,boost::shared_ptr<TEST>>::second
[source lang="cpp"]
for_each(
g_map.begin(),
g_map.end(),
boost::bind(&std::pair<int,boost::shared_ptr< TEST > >::second,_1));
[/source]
But it's failed, why?