
23 Sep
2010
23 Sep
'10
5:12 p.m.
I think I don't quite completely understand functor.., is it by C++ that a functor will be destroyed automatically once executed? Or is this a feature from boost.bind?
This is a feature of asio::io_service. By saying "functor" I mean the function-object that bind() returns. This object stores your shared_ptr as a member-data. You pass this object to io_serivce::post(), and when io_service is done with this function-object, io_service removes it from the internal queue - so the object is being destroyed with all its members.