From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-01-11 11:23:08
> I find the idea of enabling pointer arithmetic for shared_array somewhat
> questionable, but...
> shared_array in
> can be trivially extended to support it by adding
> shared_array & operator+= (std::ptrdiff_t i)
> px += i;
> return *this;
> Of course the BOOST_ASSERT(i >= 0); in operator will need to be removed.
But this operation is nonsensical in most, if not all, cases. Why would
someone need to alter a shared_array? It doesn't make sense; it means that
either before, or after the operation, the pointee array will be wrong.
I guess only operator+(int), operator-(int) should be allowed as pointer
arithmetic - if at all. operator-(T*) or operator-(sharte_array&) don't make
much sense, either.
Check out THE C++ Seminar: 3 Days with 5 Experts
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk