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

Template definition for classes that help closing resources. More...

`#include <fcleanup.h>`

## Public Member Functions
| FCloser (T *_obj)
| Constructor.
| ~FCloser ()
| Destructor. Calls the close function on the at construction time passed pointer.

## Public Attributes
T * | obj
| Remembers the pointer on which close is to be called during destruction.

## Detailed Description

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

Template definition for classes that help closing resources.

A stack allocated object of this type automatically calls the close method of an at construction time passed object when it reaches the end of its scope. It goes without saying that the given type needs to have a close method.
Intended usage:

struct CloseableObject
{
void close() {};
};
{
CloseableObject theObject;
Steinberg::FCloser<CloseableObject> theCloser (&theObject);
// Do something.
} // Here the destructor of theCloser calls the close method of theObject.
Steinberg::FCloser
Template definition for classes that help closing resources.
Definition fcleanup.h:227

## Constructor & Destructor Documentation

## ◆ FCloser()

template<class T>

FCloser | ( | T * | _obj | ) |
| inline

Constructor.

_obj is the pointer on which close is to be called when this FCloser object's destructor is executed.

## ◆ ~FCloser()

template<class T>

~FCloser | ( |  | ) |
| inline

Destructor. Calls the close function on the at construction time passed pointer.

## Member Data Documentation

## ◆ obj

template<class T>

T* obj

Remembers the pointer on which close is to be called during destruction.

Empty

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