Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-01-11 12:30:17


> > The idea is that shared_array points to the beginning of an array
> allocated
> > with new.
>
> Clearly, that's not the idea if you want to allow pointer arithmetic on
it.

It seems like you misunderstood me. Pointer arithmetic for T* consists of
operator+(int), operator+=(int), operator-(int), operator-=(int),
operator-(T*), operator-=(T*), and all relational operators between two
pointers.

Of all these, the subset I think makes sense for a shared_array<T> that is
initialized with "new T[n]" consists of: operator+(int), operator-(T*,
shared_array<T>&) (note that the shared array is only on the right-hand
side), and perhaps equality and inequality only.

I find the idea of iterators that also own arrays not too cool, but then I
drop it. Guess I'd be gladly heckled on this group if I said the sky is
blue.

Andrei

---------------------------------
Check out THE C++ Seminar: 3 Days with 5 Experts
http://www.gotw.ca/cpp_seminar/


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