Boost logo

Boost :

From: scleary_at_[hidden]
Date: 2000-12-04 10:21:52


> [Gary Powell]
> in pool.h
>
> ~pool()
> I dislike
> if (list.begin() == 0)
>
> It breaks what I think of as the iterator concept. If what is meant is
> if (list.uninitialized() )
>
> or
> if (list.empty() )
>
> that should be used instead.

Before submitting pool, I toyed around with a more advanced "iterator"-style
approach to the implementation, using iterator classes both for the
interleaved free list and for the list of memory blocks. However, I found
that it was much more trouble than it's worth; the only benefit is
implementation code that is a little cleaner in some places, and much more
complicated in others. So I dropped that idea.

> [Gary Powell]
> class PODptr should have a default constructor, rather than hide the
> default data in sized_pool. (It's partly stylistic but when you use a
value
> as an indicator of uninitialized IMO it should be done all within the
class,
> and not by the calling class.)

PODptr is a class that pretends to be a "pointer" to different class types
that don't really exist. It provides member functions to access the "data"
of the "object" it points to. Since these "class" types are of variable
size, and contains some information at the *end* of its memory (for
alignment reasons), PODptr must contain the size of this "class" as well as
the pointer to this "object".

The PODptr in sized_pool is not the default data, but rather the "pointer"
to the first memory block in the memory block list for that sized_pool.

> [Gary Powell]
> call me confused but the comment about using std::less_equal and std::less
> doesn't make sense to me. It states that the standard operators may return
> unspecified results, yet when I look at the source to these functors, they
> use the standard operators. Does the standard specify that for void *
types
> these functors will return a valid result and not the operators >= and > ?

The operators < <= > >= are only defined for pointers to objects that are 1)
in the same array, or 2) subobjects of the same object [5.9/2]. They may
yield a total order, but are not required to.

The functors do have a stricter guarantee: "For templates greater, less,
greater_equal, and less_equal, the specializations for any pointer type
yield a total order, even if the built-in operators <, >, <=, >= do not."
[20.3.3/8].

        -Steve


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