Base Module VST 3.7 SDK for developing VST plug-in

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
FDeleter< T > Struct Template Reference

Template definition for classes that help guarding against memory leaks. More...

`#include <fcleanup.h>`

## Public Member Functions
| FDeleter (T *_toDelete)
| Constructor.
| ~FDeleter ()
| Destructor. Calls delete on the at construction time passed pointer.

## Public Attributes
T * | toDelete
| Remembers the object that is to be deleted during destruction.

## Detailed Description

template<class T>
struct Steinberg::FDeleter< T >

Template definition for classes that help guarding against memory leaks.

A stack allocated object of this type automatically deletes an at construction time passed dynamically allocated single object when it reaches the end of its scope.
Intended usage:

{
int* pointerToInt = new int;
Steinberg::FDeleter<int> deleter (pointerToInt);
// Do something with the variable behind pointerToInt.
} // No memory leak here, destructor of deleter cleans up the integer.
Steinberg::FDeleter
Template definition for classes that help guarding against memory leaks.
Definition fcleanup.h:61

## Constructor & Destructor Documentation

## ◆ FDeleter()

template<class T>

FDeleter | ( | T * | _toDelete | ) |
| inline

Constructor.

_toDelete is a pointer to the dynamically allocated object that is to be deleted when this FDeleter object's destructor is executed.

## ◆ ~FDeleter()

template<class T>

~FDeleter | ( |  | ) |
| inline

Destructor. Calls delete on the at construction time passed pointer.

## Member Data Documentation

## ◆ toDelete

template<class T>

T* toDelete

Remembers the object that is to be deleted during destruction.

Empty

Copyright © Steinberg Media Technologies GmbH. All Rights Reserved. This documentation is under this license.