
5 Jun
2007
5 Jun
'07
2:57 a.m.
One important advantage of using boost::function is that it acts like a function pointer, reducing physical coupling between compilation units. This is very much like shared_ptr. A nice feature of shared_ptr is that it has a single template parameter, T, even though diferent instances of shared_ptr<T> can use different allocators. When using boost::function, one can also provide an allocator, but unlike shared_ptr, the allocator is a default parameter of the boost::function class template. Is there a reason why this is necessary? Can't boost::function use similar technique to the one employed by shared_ptr to avoid the need for this second template parameter? Emil Dotchevski