I want to add a series of strings to a combo box using std::for_each. The objects are of type Category
and I need to call GetName
on them. How can I achieve this with boost::bind
?
const std::vector<Category> &categories = /**/;
std::for_each(categories.begin(), categories.end(), boost::bind(&CComboBox::AddString, &comboBox, _1);
The current code fails as it's trying to call CComboBox::AddString(category)
. Which is obviously wrong. How can I call CComboBox::AddString(category.GetName())
using the current syntax?