Base Module: FPtrNuller< 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
FPtrNuller< T > Struct Template Reference

Template definition for classes that help guarding against dangling pointers. More...

`#include <fcleanup.h>`

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

## Public Attributes
T *& | toNull
| Remembers the pointer that is to be set to NULL during destruction.

## Detailed Description

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

Template definition for classes that help guarding against dangling pointers.

A stack allocated object of this type automatically resets an at construction time passed pointer to null when it reaches the end of its scope.
Intended usage:

int* pointerToInt = 0;
{
int i = 1;
pointerToInt = &i;
Steinberg::FPtrNuller<int> ptrNuller (pointerToInt);
// Do something with pointerToInt.
} // No dangling pointer here, pointerToInt is reset to 0 by destructor of ptrNuller.
Steinberg::FPtrNuller
Template definition for classes that help guarding against dangling pointers.
Definition fcleanup.h:105

## Constructor & Destructor Documentation

## ◆ FPtrNuller()

template<class T>

FPtrNuller | ( | T *& | _toNull | ) |
| inline

Constructor.

_toNull is a reference to the pointer that is to be reset to NULL when this FPtrNuller object's destructor is executed.

## ◆ ~FPtrNuller()

template<class T>

~FPtrNuller | ( |  | ) |
| inline

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

## Member Data Documentation

## ◆ toNull

template<class T>

T*& toNull

Remembers the pointer that is to be set to NULL during destruction.

Empty

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