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: -

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::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
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,

View this message in context:
Sent from the Boost - Users mailing list archive at

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at