
"JOAQUIN LOPEZ MU?Z" wrote:
Hello Robert,
----- Mensaje original ----- De: Robert Ramey <ramey@rrsd.com> Fecha: Domingo, Febrero 3, 2008 8:01 pm Asunto: [boost] question about flyweight Para: boost@lists.boost.org
I've spent a tiny amount of time looking over the flyweight documentation and some code and I have a couple minor observations along with a really dumb question.
a) when I see boost::flyweight::flyweights it confuses me. I suppose its no big deal.
It's boost::flyweights::flyweight, actually. The reason for the spurious ess is explained at:
http://lists.boost.org/Archives/boost/2008/01/132628.php
b) I'm curious about the serialization implementation. Why didn't you choose just to serialize the factory? This seems to me the most obvious implementation and I wonder why you didn't feel it was a good choice. [...] In short, I don't see why a "helper" is required.
Details aside, it all boils down to this:
ar << f.h;
This only works off the shelf if f.h is a pointer, which is not the case in general (the type of this handle is provided by the particular factory used, and need not be a pointer, for instance in set_factroy is a std::set::iterator). Briefly put, the serialization helper used by flyweight mimics for handle_type the tracking facilities Boost.Serialization provides natively for pointers.
The default is to track if and only if its serialized through a pointer. If the tracking level serialization trait for flyweight<T> is set to track_always it should work with all objects. I would think that you could get the effect you intend by just setting this serialization trait.for these types. Robert Ramey
Joaquín M López Muñoz Telefónica, Investigación y Desarrollo _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost