Boost logo

Boost :

From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2001-04-02 12:23:14


After looking at Daryle's version of auto_ary, I modified auto_array_ptr to
include X &operator[], and X const & operator[] const. Thanks Daryle.
(I added a minor test case to main.cpp as well.)

I also had missed two of the deletes, and added if (sizeof(X)) delete p; to
all of them.

Since auto_ptr does not allocate any memory, I did not include the
constructor. (Trying to follow the "int" rule.)

auto_array_ptr(size_t n) : p (new X[n] ) {}
which does exist in auto_ary.

auto_array_ptr for operator[], has both a const and non const version,
following the lead by std::vector.

Thoughts? Comments? Should this constructor be included?

I don't think the file auto_array.hpp should include other memory stuff.

Anyone else had a chance to compile this code? (Still gcc 2.95 and MSVC 6.5
compatible.)

  -gary-

gary.powell_at_[hidden]

You can access this file at the URL
 
http://groups.yahoo.com/group/boost/files/auto_array_ptr/auto_array.hpp


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