libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::LIBJMMCG_VER_NAMESPACE::singleton::leaked_meyers< V > Struct Template Reference

A so-called "Meyers" singleton. More...

#include <singleton.hpp>

Public Types

typedef V element_type
 The type of the object "managed". More...
 
typedef void argument_type
 
typedef argument_type first_argument_type
 
typedef element_type result_type
 

Static Public Member Functions

static element_typeinstance () noexcept(false)
 Obtain the unique instance of the object. More...
 

Detailed Description

template<class V>
struct jmmcg::LIBJMMCG_VER_NAMESPACE::singleton::leaked_meyers< V >

A so-called "Meyers" singleton.

Note that this implementation specifically leaks, and does not clean up, even at atexit(), any resource it allocates. Based upon the "Meyers Singleton" from [1], that reference gives full details of the undefined & implementation-defined "features" of this type of singleton.

[1] "Modern C++ Design" by A. Alexandrescu, Chapter 6 "Implementing Singletons", page 133

Definition at line 31 of file singleton.hpp.

Member Typedef Documentation

◆ argument_type

Definition at line 33 of file singleton.hpp.

◆ element_type

The type of the object "managed".

Definition at line 32 of file singleton.hpp.

◆ first_argument_type

◆ result_type

Definition at line 35 of file singleton.hpp.

Member Function Documentation

◆ instance()

template<class V >
static element_type& jmmcg::LIBJMMCG_VER_NAMESPACE::singleton::leaked_meyers< V >::instance ( )
inlinestaticnoexcept

Obtain the unique instance of the object.

Returns
The unique instance of the object, initialised and allocated upon the heap, upon first calling, assuming sufficient resources exist.

Definition at line 41 of file singleton.hpp.


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