Base Module: FArrayDeleter< T > Struct Template Reference
Author: Steinberg

Base Module VST 3.8 SDK for developing VST plug-in

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

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

`#include <fcleanup.h>`

## Public Member Functions
| FArrayDeleter (T *_arrayToDelete)
| Constructor.
| ~FArrayDeleter ()
| Destructor. Calls delete[] on the at construction time passed pointer.

## Public Attributes
T * | arrayToDelete
| Remembers the array of objects that is to be deleted during destruction.

## Detailed Description

template<class T>
struct Steinberg::FArrayDeleter< 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 array of objects when it reaches the end of its scope.
Intended usage:

{
int* pointerToIntArray = new int[10];
Steinberg::FArrayDeleter<int> deleter (pointerToIntArray);
// Do something with the array behind pointerToIntArray.
} // No memory leak here, destructor of deleter cleans up the integer array.
Steinberg::FArrayDeleter
Template definition for classes that help guarding against memory leaks.
Definition fcleanup.h:71

## Constructor & Destructor Documentation

## ◆ FArrayDeleter()

template<class T>

FArrayDeleter | ( | T * | _arrayToDelete | ) |
| inline

Constructor.

_arrayToDelete is a pointer to the dynamically allocated array of objects that is to be deleted when this FArrayDeleter object's destructor is executed.

## ◆ ~FArrayDeleter()

template<class T>

~FArrayDeleter | ( |  | ) |
| inline

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

## Member Data Documentation

## ◆ arrayToDelete

template<class T>

T* arrayToDelete

Remembers the array of objects that is to be deleted during destruction.

Empty

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