LibreOffice LibreOffice 5.3 SDK C/C++ API Reference

Classes | Static Public Member Functions | List of all members
rtl::StaticWithArg< T, Data, 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 (const Data &rData)
| Gets the static. More...
static T & | get (Data &rData)
| Gets the static. More...

## Detailed Description

### template<typename T, typename Data, typename Unique>
class rtl::StaticWithArg< T, Data, 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

  T | variable's type
  Unique | Implementation trick to make the inner static holder unique, using the outer class (the one that derives from this base class)

## Member Function Documentation

## ◆ get() [1/2]

template<typename T , typename Data , typename Unique >

static T& rtl::StaticWithArg< T, Data, Unique >::get | ( | const Data & | rData | ) |
| inline static

Gets the static.

Mutual exclusion is performed using the osl global mutex.

Returns
  static variable

## ◆ get() [2/2]

template<typename T , typename Data , typename Unique >

static T& rtl::StaticWithArg< T, Data, Unique >::get | ( | Data & | rData | ) |
| inline static

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:

- rtl/instance.hxx