Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2002-01-11 04:49:50

> 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
> [] 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 (10-15 lines) -
and certainly a thing to do. By popular demand, I'm implementing an
ArrayStoragePolicy that does exactly that.

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[] to 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 to implement that without complicating the
policies' interfaces.


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