Boost logo

Boost :

From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2002-01-10 02:39:41

From: "Andrei Alexandrescu" <andrewalex_at_[hidden]>
Sent: Wednesday, January 09, 2002 11:37 PM
> If you really want that, I think it's better to implement a limited
> arithmetic than opening the floodgates by allowing conversions. There's
> smart pointer arithmetic that doesn't make sense, for example subtraction
> unsigned integers. I haven't studied the problem too much yet, but I guess
> you can implement arithmetic even without allowing automatic conversion.

Indeed you can --- see my GenericPtr code and article from Overload

This enables pointer arithmetic on a GenericPtr without accidentally
deallocating the array --- given a GenericPtr<int> "gpi" that points to an
array, gpi+3 is a new GenericPtr<int> that also points to the array, and
increments the reference count. Only when both pointers die is the array


Do You Yahoo!?
Get your free address at

Boost list run by bdawes at, gregod at, cpdaniel at, john at