Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-01-11 02:38:22


> I won't question your decision to not support the *_array versions by
> default since I mostly agree with it.
>
> But don't you think that the smart_ptr power user should be able to make
an
> [] supporting pointer using a policy? (This is a specific instance of a
> general problem: adding features to smart_ptr using a policy.)

That kind of flexibility is a cool thing, though of course it shouldn't be
forgotten that a smart pointer is a smart pointer, not a kitchen sink.

Creating a StoragePolicy that inherits the default StoragePolicy, uses
delete[] and defines operator[] and some arithmetic is easy. The thing is,
you'd want to use CheckingPolicy before you do a dereference. And the
problem raised by Beman comes up: how do you get StoragePolicy's operator[]
use the CheckingPolicy to check the pointer?

The more I think of it, the more sense makes to enable free inter-policy
communication. Would be cool, I think, to find how to do that while still
keep it simple for the users who don't care about that.

Andrei


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