template class ugcs::vsm::internal::Singleton_creator

Overview

Helper class for singletons instantiation. More…

#include <singleton.h>

template <class T, class = void>
class Singleton_creator
{
public:
    // methods

    static std::shared_ptr<T> Create();

    template <typename... Args>
    static std::shared_ptr<T> Create(Args&&... args);
};

Detailed Documentation

Helper class for singletons instantiation.

It deals with classes both having and not having default constructor.

Methods

static std::shared_ptr<T> Create()

Get singleton instance for a class which does not have default constructor.

It is never created without arguments, so return null.

template <typename... Args>
static std::shared_ptr<T> Create(Args&&... args)

Create singleton instance.

Parameters:

args

Arguments for singleton class constructor.

Returns:

Pointer to the created object.