Boost logo

Boost :

From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2001-03-30 13:00:47

  I took the version of auto_array_ptr that Greg Colvin posted last October
and "boostified" it. As in it now compiles with gcc 2.95.2 and MSVC sp 5
(And I suspect sp 4).

  This file has its own version of auto_ptr, and neither Greg nor I are sure
that we should supply a boost::auto_ptr, vs relying on the existence of

  This code could use some compilation testing on other compilers, and if
there are any volunteers to write the document, it could use it. (I am
really busy for the next month or two.) But I did need the functionality for
my day job, so I did the port.

  The test code could also be expanded. I'm sure that I'll be doing test by
fire in my project, not the best way, but one way.

  Also if it becomes part of the boost library, boost::shared_array<> should
have a constructor that takes a auto_array_ptr, just as boost:shared_ptr<>
can take a std::auto_ptr.

  In addition Greg isn't sure that a auto_array_ptr should exist at all. I
think I need it, but then I've been known to be wrong on these sort of
things. I don't want to use vector<> in all cases. It isn't always
necessary. auto_array_ptr's intended use is the same limited use as
auto_ptr, where you need to allocate an array, and pass ownership to another
function. And there are other alternative ways of handling auto_array's see
the history in October 2000, look for auto_array or look at Codewarrior's
extended version of auto_ptr.

  Comments are solicited and welcome.



  I added the trick of sizeof(T); to the delete operators to force the
definition of T to be in scope. So I suppose that makes boost::auto_ptr a
little better than std::auto_ptr.

// -----------------------------------------
> Description : initial version of auto_array_ptr
> You can access this file at the URL

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