From 076667dc0064432a3d4e3cf696d6688ee01a17a9 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Fri, 17 Nov 2017 23:28:15 -0600 Subject: COMMON: Add limited support for custom deleters to ScopedPtr Custom deleters of ScopedPtr are not currently fully conforming to C++11's support for custom deleters in std::unique_ptr for the sake of simplicity of implementation. Unlike in the standard library, plain functions and lvalue references are not supported, nor may custom deleters be passed to the constructor at runtime. This can be improved in the future, if necessary, by doing what standard library implementations usually do and creating a Pair class that uses the Empty Base Optimization idiom to avoid extra storage overhead of the deleter instance when it is not needed, as in typical standard library implementations, plus some additional type traits to support the necessary metaprogramming for the different type overloads. --- graphics/surface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'graphics') diff --git a/graphics/surface.h b/graphics/surface.h index 87c5f52503..19107b8bab 100644 --- a/graphics/surface.h +++ b/graphics/surface.h @@ -334,7 +334,7 @@ public: * * This deleter assures Surface::free is called on deletion. */ -struct SharedPtrSurfaceDeleter { +struct SurfaceDeleter { void operator()(Surface *ptr) { if (ptr) { ptr->free(); -- cgit v1.2.3