
On 3/2/2011 9:28 AM, Vicente Botet wrote:
Charlls Quarra wrote:
[...]
Thats fine ;-), i'm not discussing the reason of having heap allocations in there; all i'm saying is that there should be the option for the user to pass a custom allocator type (as a templater parameter, as is customary for std:: libs) that these (any) allocations can be delegated to
The problem adding the Allocator as a template parameters is that it change the type. Note that Boost.Fiber follows here the design of Boost.Thread, which is on a std lib (C++0x)
Could the allocator be embedded into the implementation object and accessed through virtual functions? I *think* the specific type of the allocator would only show up in the fiber interface in the (template) constructor overload selected at construction, e.g., template< class Allocator > fiber::fiber(Allocator alloc)... I'm not promising that this would work, but, in the event that it could, I wouldn't expect a fiber object to do too many allocations (unlike, say, a std container), so this shouldn't incur a significant overhead... I only mention this as a compromise if adding an Allocator template parameter is d.o.a. - Jeff