There is a gcc extension which allows lambda templates:
// create the widgets and set the label
base::for_each(_widgets, [] <typename Key_T, typename Widget_T>
(boost::fusion::pair<Key_T, Widget_T*>& pair) -> void {
pair.second = new Widget_T();
pair.second->set_label_str(Key_T::label);
}
);
where _widgets
is a std::tuple< fusion::pair<Key_T, Widget_T>... >