LibreOffice
LibreOffice 24.2 SDK C/C++ API Reference
Classes | Static Public Member Functions | List of all members
rtl::Static< T, Unique > Class Template Reference

Helper base class for a late-initialized (default-constructed) static variable, implementing the double-checked locking pattern correctly. More...

#include <instance.hxx>

Static Public Member Functions

static T & get ()
 Gets the static. More...
 

Detailed Description

template<typename T, typename Unique>
class rtl::Static< T, Unique >

Helper base class for a late-initialized (default-constructed) static variable, implementing the double-checked locking pattern correctly.

Derive:
Derive from this class (common practice), e.g.
struct MyStatic : public rtl::Static<MyType, MyStatic> {};
...
MyType & rStatic = MyStatic::get();
...
Template Parameters
Tvariable's type
UniqueImplementation trick to make the inner static holder unique, using the outer class (the one that derives from this base class)

Member Function Documentation

◆ get()

template<typename T , typename Unique >
static T& rtl::Static< T, Unique >::get ( )
inlinestatic

Gets the static.

Mutual exclusion is performed using the osl global mutex.

Returns
static variable

The documentation for this class was generated from the following file: