Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2004-04-29 11:16:06

Fredrik Blomqvist wrote

> Thinking about smart pointer serialization and how to generalize it, ie.
> to allow serialization of any "my_ref_count_ptr", I got this idea.
> -How about extending the tracking system with a case something like:
> serialization::track_ref_count? (perhaps using a is_smart_ptr<> traits
> function).

> Based on this tag the serializer would at load time maintain a
> map<pointer_value, my_ref_count_ptr<T> > to enable the ref-copy "bumping"
> of all the subsequent my_ref_count_ptrs.
> Where pointer_value is used as key and obtained by boost::get_pointer
> (assumed to be specialized for my_ref_ptr).

> This is essentially the same approach I outlined earlier in my reviews and
> seems similar to both what Peter Dimov uses and Gennadiy mentions above.
> It would of course require extensions to the code but I think it would
> possible to use/adapt the existing pointer code-path to some degree.

As far as I can tell, this is exactly equivalent to what the shared_ptr case
study in the documentation/code currently do. No special modification to
the library was necessary to accomplish this. Indeed, that was the point of
the demo and documentation.

The question that has been raised is whether even this is more than is
necessary. I have yet to address this in detail.

In my opinion, any situation which required special support to be added to
the library would reveal a flaw in the library design or implementation. In
the future - the library will be smaller - not larger.

Robert Ramey

Boost list run by bdawes at, gregod at, cpdaniel at, john at