Modified scoped_* to use checked_delete; HP aCC doesn't like the inline assertions.

[SVN r12832]
This commit is contained in:
Peter Dimov
2002-02-16 13:23:01 +00:00
parent 7981b647c3
commit 2482e00224
2 changed files with 6 additions and 10 deletions

View File

@@ -13,6 +13,7 @@
//
#include <boost/assert.hpp>
#include <boost/checked_delete.hpp>
#include <boost/config.hpp> // in case ptrdiff_t not in std
#include <cstddef> // for std::ptrdiff_t
@@ -42,17 +43,14 @@ public:
~scoped_array() // never throws
{
typedef char type_must_be_complete[sizeof(T)];
delete [] ptr;
checked_array_delete(ptr);
}
void reset(T * p = 0) // never throws
{
typedef char type_must_be_complete[sizeof(T)];
if (ptr != p)
{
delete [] ptr;
checked_array_delete(ptr);
ptr = p;
}
}

View File

@@ -13,6 +13,7 @@
//
#include <boost/assert.hpp>
#include <boost/checked_delete.hpp>
namespace boost
{
@@ -41,17 +42,14 @@ public:
~scoped_ptr() // never throws
{
typedef char type_must_be_complete[sizeof(T)];
delete ptr;
checked_delete(ptr);
}
void reset(T * p = 0) // never throws
{
typedef char type_must_be_complete[sizeof(T)];
if (ptr != p)
{
delete ptr;
checked_delete(ptr);
ptr = p;
}
}