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.
This commit is contained in:
parent
62d6a80c86
commit
076667dc00
4 changed files with 82 additions and 24 deletions
|
@ -39,7 +39,7 @@ void SaveStateDescriptor::setThumbnail(Graphics::Surface *t) {
|
|||
if (_thumbnail.get() == t)
|
||||
return;
|
||||
|
||||
_thumbnail = Common::SharedPtr<Graphics::Surface>(t, Graphics::SharedPtrSurfaceDeleter());
|
||||
_thumbnail = Common::SharedPtr<Graphics::Surface>(t, Graphics::SurfaceDeleter());
|
||||
}
|
||||
|
||||
void SaveStateDescriptor::setSaveDate(int year, int month, int day) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue