mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1251723 - remove ScopedDeletePtr; r=Waldo
UniquePtr is more standard than ScopedDeletePtr; using standard constructs whenever possible is preferable.
This commit is contained in:
parent
9e95296e04
commit
76173ee85d
@ -23,9 +23,8 @@
|
||||
*
|
||||
* - |ScopedFreePtr| - a container for a pointer, that automatically calls
|
||||
* |free()| at the end of the scope;
|
||||
* - |ScopedDeletePtr| - a container for a pointer, that automatically calls
|
||||
* |delete| at the end of the scope;
|
||||
*
|
||||
* |ScopedDeletePtr| is removed in favor of |UniquePtr<T>|.
|
||||
* |ScopedDeleteArray| is removed in favor of |UniquePtr<T[]>|.
|
||||
*
|
||||
* The general scenario for each of the RAII classes is the following:
|
||||
@ -235,19 +234,6 @@ struct ScopedFreePtrTraits
|
||||
};
|
||||
SCOPED_TEMPLATE(ScopedFreePtr, ScopedFreePtrTraits)
|
||||
|
||||
/*
|
||||
* ScopedDeletePtr is a RAII wrapper for pointers that need to be deleted.
|
||||
*
|
||||
* struct S { ... };
|
||||
* ScopedDeletePtr<S> foo = new S();
|
||||
*/
|
||||
template<typename T>
|
||||
struct ScopedDeletePtrTraits : public ScopedFreePtrTraits<T>
|
||||
{
|
||||
static void release(T* aPtr) { delete aPtr; }
|
||||
};
|
||||
SCOPED_TEMPLATE(ScopedDeletePtr, ScopedDeletePtrTraits)
|
||||
|
||||
/*
|
||||
* MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE makes it easy to create scoped
|
||||
* pointers for types with custom deleters; just overload
|
||||
|
Loading…
Reference in New Issue
Block a user