From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2007-11-16 10:35:35
Emil Dotchevski a écrit :
> I'll make one last attempt... :)
> Let's say I have a vector< flyweight<string> > container. Let's also
> assume that, based on the value of the stored string object, I want to
> allocate the flyweight differently. No problem, right? All I have to
> do is write a custom factory, and change my container's value type:
> vector< flyweight<string,tag<my_factory> > >. So, my_factory inspects
> the string value passed to it, and uses the appropriate allocation
> But what if I can't hard-code the factory behavior? What if I want to
> allow user code to choose how each individual flyweight<string> is to
> be allocated?
Why not make a factory that does dynamic dispatch?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk