Helper base class for a late-initialized static variable, implementing the double-checked locking pattern correctly. More...
#include <instance.hxx>
Classes | |
| struct | StaticInstanceWithInit |
Static Public Member Functions | |
| static T & | get () |
| Gets the static. | |
Helper base class for a late-initialized static variable, implementing the double-checked locking pattern correctly.
Derive from this class (common practice), providing an initializer functor class, e.g.
struct MyStatic : public rtl::StaticWithInit<MyType, MyStatic> {
MyType operator () () {
...
return MyType( ... );
}
};
...
MyType & rStatic = MyStatic::get();
...
| T | variable's type | |
| InitData | initializer functor class | |
| Unique | Implementation trick to make the inner static holder unique, using the outer class (the one that derives from this base class). Default is InitData (common practice). | |
| Data | Initializer functor's return type. Default is T (common practice). |
| static T& rtl::StaticWithInit< T, InitData, Unique, Data >::get | ( | ) | [inline, static] |
1.6.1