mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-07-31 21:24:40 +02:00
Modified scoped_* to use checked_delete; HP aCC doesn't like the inline assertions.
[SVN r12832]
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user