Boost logo

Boost Users :

Subject: [Boost-users] Using a shared_ptr in a boost::function definition?
From: Ashley McConnell (ashley_at_[hidden])
Date: 2009-05-04 04:35:45


Hi Folks,

I can't quite figure out how to do this correctly (*note* the types ending
in Ptr are typedef'd boost::shared_ptr types)

I have a function like so: -

void setCompleteFunction(boost::function< void (int errorCode, const string
&data, HeaderMapPtr headers) > f);

I try to bind to it: -

wc->setCompleteFunction(boost::bind(&NetworkEventHandler::receiveSkinDownloadResult,
this, _1, _2, _3, wc,myFile, filename.str(), carId, crc, networkPlayerId));

I get quite a few errors indicating that it can't match to this pattern,
this is the most sensible message: -

error C2784:
'boost::_bi::bind_t<R,F,_bi::list_av_9<A1,A2,A3,A4,A5,A6,A7,A8,A9>::type>
boost::bind(boost::type<T>,F,A1,A2,A3,A4,A5,A6,A7,A8,A9)' : could not deduce
template argument for 'boost::type<T>' from 'void (__thiscall
Sirocco::NetworkEventHandler::* )(int,const std::string
&,Sirocco::HeaderMapPtr,Sirocco::IWebConnectionPtr,Sirocco::FilePtr,const
std::string &,const std::string &,const std::string &,const std::string &)'

If i don't put the shared_ptr in there (and remove the _3) it works as
expected, any idea what I could be doing wrong?

Thanks for your help
All the best,
Ash
                

-- 
View this message in context: http://www.nabble.com/Using-a-shared_ptr-in-a-boost%3A%3Afunction-definition--tp23360396p23360396.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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