Boost logo

Boost :

From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-01-02 10:01:05


> It's not complicated at all, and easy to remember, when you consider that
> point and size exactly parallel C++'s pointer and size_t (if we choose to use
> these semantics):
>
> pointer + pointer // illegal
> pointer - pointer -> size
> pointer + size -> pointer
> poniter - size -> pointer

Actually, I think you should have said "ptrdiff_t", not "size_t"

> Also, having different constructors that take the different types is nothing
> new:
> vector(pointer, pointer) -> create vector with these contents
> vector(size) -> create empty vector with this size

These nice parallels notwithstanding, I worry about using the name 'size'
this way since it is used for the STL containers to mean something
different. It really does mean something more like "difference" in this
case, so I guess my preference for 'extent' doesn't work too well either.

Suppose we called it 'delta' (ick)?

I suggest the member function name 'extent' should be used to get the size
of a rectangle, and should return a delta.


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