mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-08-03 06:34:26 +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/assert.hpp>
|
||||||
|
#include <boost/checked_delete.hpp>
|
||||||
#include <boost/config.hpp> // in case ptrdiff_t not in std
|
#include <boost/config.hpp> // in case ptrdiff_t not in std
|
||||||
#include <cstddef> // for std::ptrdiff_t
|
#include <cstddef> // for std::ptrdiff_t
|
||||||
|
|
||||||
@@ -42,17 +43,14 @@ public:
|
|||||||
|
|
||||||
~scoped_array() // never throws
|
~scoped_array() // never throws
|
||||||
{
|
{
|
||||||
typedef char type_must_be_complete[sizeof(T)];
|
checked_array_delete(ptr);
|
||||||
delete [] ptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset(T * p = 0) // never throws
|
void reset(T * p = 0) // never throws
|
||||||
{
|
{
|
||||||
typedef char type_must_be_complete[sizeof(T)];
|
|
||||||
|
|
||||||
if (ptr != p)
|
if (ptr != p)
|
||||||
{
|
{
|
||||||
delete [] ptr;
|
checked_array_delete(ptr);
|
||||||
ptr = p;
|
ptr = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
#include <boost/checked_delete.hpp>
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
@@ -41,17 +42,14 @@ public:
|
|||||||
|
|
||||||
~scoped_ptr() // never throws
|
~scoped_ptr() // never throws
|
||||||
{
|
{
|
||||||
typedef char type_must_be_complete[sizeof(T)];
|
checked_delete(ptr);
|
||||||
delete ptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset(T * p = 0) // never throws
|
void reset(T * p = 0) // never throws
|
||||||
{
|
{
|
||||||
typedef char type_must_be_complete[sizeof(T)];
|
|
||||||
|
|
||||||
if (ptr != p)
|
if (ptr != p)
|
||||||
{
|
{
|
||||||
delete ptr;
|
checked_delete(ptr);
|
||||||
ptr = p;
|
ptr = p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user