Base Module VST 3.7 SDK for developing VST plug-in

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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.

## Constructor & Destructor Documentation

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 | ( |  | ) |
| inline

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

## Member Data Documentation

T*& toNull

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

Empty

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