From: "someuserat"
void WidgetManager::addMap(const WidgetMapPtr i){ maps_.push_back(i); // have to write a function adapter here? for_each(widgetset_.begin(),widgetset_.end(),i->insert); }
I think that you need bind(&WidgetMap::insert, i, _1) here. [...]
void WidgetManager::dropWidgetMember(const DataMemberPtr d){
// delete any maps using the target member // how to fix this bloody line? getIndexedMember returns a DataMemberPtr to the member it is keyed on.
maps_.erase(remove_if(maps_.begin(),maps_.end(),(boost::mem_fn(&WidgetMap::g etIndexedMember)).equals(d))); This is getting harder. bind(&DataMember::equals, bind(&WidgetMap::getIndexedMember, _1), d) would be my guess. Easier would be to define a helper function bool memberEquals(WidgetMap const & m, DataMemberPtr d) { return m.getIndexedMember().equals(d); } and then use bind(memberEquals, _1, d) in dropWidgetMember.