|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-09-19 11:26:23
From: "someuserat" <marktutt_at_[hidden]>
[...]
> 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.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net