Boost logo

Boost :

Subject: Re: [boost] [Shifted Pointer] Review Request
From: Joel Young (jdy_at_[hidden])
Date: 2011-04-22 10:36:15


Phil Bouchard <philippe <at> fornux.com> writes:

> I would like to request a review of the Shifted Pointer utility.

Is it possible to select a name for this library that identifies
what it is used for rather than how it does it?

----FROM THE DOCS----
The name shifted_ptr<T> first comes from one of its caracteristic where the
reference counter is allocated at the same time the pointee object is. Only the
pointer to the object is known by shifted_ptr<T> and in order to access the
reference counter, the pointer to the top of the object is "shifted" up. The
name of the class shifted<T> used to instanciate all pointee objects is simply
taken from the name shifted_ptr<T> it will be assigned to.
----FROM THE DOCS----

rc_pointer?
set_based_reference_counted_pointer?
heap_set_shared_pointer?

Also, the documentation needs an editorial pass through at some point by a
native speaker that groks the approach. It is not easy reading at this point.
For example, the paragraph above might be rewritten:

-----REWRITE-----
The name shifted_ptr<T> is inspired by the specific reference counting
algorithm used. When an object pointed to by a shifted_ptr<T> is allocated,
the reference counter for that object (set of objects?) is allocated at the
same time. However, the shifted_ptr<T> doesn't actually keep a pointer to the
reference counter. It calculates its address on the fly by "shifting up" the
pointer to the object to that of the reference counter.

The type used to instantiate the objects managed by the shifted_ptr<T> is
likewise named shifted<T>.
-----REWRITE-----

Is that clearer?

Based on my rewrite, the name "shifted_ptr" is an artefact
of the algorithm used, not informative regarding what it does or how it is
used.

Joel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk