Struct default_delete


#include <include/EASTL/internal/smart_ptr.h>

template <typename T>
struct default_delete



C++11 smart pointer default delete function class.

Provides a default way to delete an object. This default is simply to call delete on the object pointer. You can provide an alternative to this class or you can override this on a class-by-class basis like the following: template <> struct smart_ptr_deleter<MyClass> { void operator()(MyClass* p) const { SomeCustomFunction(p); } };


default_delete overload


Lines 152-166 in include/EASTL/internal/smart_ptr.h.

template <typename T>
struct default_delete
    #if defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION <= 4006) // GCC prior to 4.7 has a bug with noexcept here.
        EA_CONSTEXPR default_delete() = default;
        EA_CONSTEXPR default_delete() EA_NOEXCEPT = default;
    template <typename U>  // Enable if T* can be constructed with U* (i.e. U* is convertible to T*).
    default_delete(const default_delete<U>&, typename eastl::enable_if<is_convertible<U*, T*>::value>::type* = 0) EA_NOEXCEPT {}
    void operator()(T* p) const EA_NOEXCEPT
        { delete p; }

Add Discussion as Guest

Log in