$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Hughes, James (jhughes_at_[hidden])
Date: 2007-06-11 07:42:24
 
> > Hello all,
> > 
> > I'm trying to use bind to help with removeif in a std::map<string, 
> > shared_ptr<something> >. I want to remove items where the 
> shared_ptr 
> > use_count is 1.
> > 
> > map<string, shared_ptr<data> > Fred;
> > 
> > RemoveIf(Fred.begin(),
> >          Fred.end(),
> >          boost::bind(std::equal_to<long>(),
> > 		1,
> > 		boost::bind(&map<string, shared_ptr<data>
> > >::value_type::second::use_count, _1)
> > 	)
> > 
> > However, I get a compile error on ::second not being a class or 
> > namespace.
> > 
> > Anyone know how I should do this? I'm a beginner at 
> boost::bind, so be 
> > gentle....
> > 
> > James
> 
> 
> Sorry, that should read remove_if, and in fact the purpose is 
> better served using shared_ptr<>::unique, which should mean I 
> can get rid of the std:equal_to stuff
> 
> RemoveIf(Fred.begin(),
>          Fred.end(),
> 	   boost::bind(&map<string, shared_ptr<data>
> >::value_type::second::unique, _1)
> 	)
> 
> Still get same compile fault however. 
> 
> James
> 
>
Have now replaced second in above with second_type
Remove_if(Fred.begin(),
          Fred.end(),
            boost::bind(&map<string, shared_ptr<data>
>::value_type::second_type::unique, _1)
         )
 
And am not getting a completely differnet error - bind seems to be doing
a load of work, but eventually I get an
mem_fn_template.hpp:90: error : No matching function for call to
'get_pointer(const std::pair<const std::string, boost::shared_ptr<data>
> &)'
I'm running out of ideas here so all welcome..
James
This message (including any attachments) contains confidential 
and/or proprietary information intended only for the addressee.  
Any unauthorized disclosure, copying, distribution or reliance on 
the contents of this information is strictly prohibited and may 
constitute a violation of law.  If you are not the intended 
recipient, please notify the sender immediately by responding to 
this e-mail, and delete the message from your system.  If you 
have any questions about this e-mail please notify the sender 
immediately.