I would really like to specify the SBO size on boost::function! How
about changing the signature to?:
template
class function;
I've been trying to do a work around using the constructor with the
allocator. I was going to define my own function class derived from the
boost one, with a private one time allocator using a private buffer.
This approach works find as long as constructors where the Functor type
is present.
The copy constructor and equals operators require serious hackery, since
these constructors on boost function don't allow you to pass a new allow
you to pass a new allocator. There's no
template<typename Allocator>
functionN(const functionN&, Allocator);
This means that the Function constructor has to affect data underlying
the const Function instance it's copying such that when the allocator is
copied over it mutates into one that points at the private buffer of the
new constructing instance.
This is doable, but kind of scary since I'm making assumptions about
when and how the Allocator is copied.
This is also not such a wonderful solution, because the SBO is wasted.
Any chance of just parameterizing the SBO size?
Chris