1#ifndef ORIGINAL_SINGLETON_H
2#define ORIGINAL_SINGLETON_H
66 template<
typename TYPE>
117 template<
typename...
Args>
149 template<
typename...
Args>
154template<
typename TYPE>
157template <
typename TYPE>
159 return instance_ !=
nullptr;
162template <
typename TYPE>
163template <
typename ...
Args>
165 if (instance_ ==
nullptr) {
168 throw valueError(
"Instance already exists, do you mean reset(args...)?");
172template <
typename TYPE>
174 if (instance_ ==
nullptr) {
180template <
typename TYPE>
182 if (instance_ !=
nullptr) {
187template <
typename TYPE>
188template <
typename ...
Args>
Exception for null pointer dereference attempts.
Definition error.h:245
Unique ownership smart pointer with move semantics.
Definition ownerPtr.h:37
Thread-safe singleton pattern implementation with ownership management.
Definition singleton.h:67
singleton(singleton &&)=delete
Deleted move constructor to prevent moving.
singleton(const singleton &)=delete
Deleted copy constructor to prevent copying.
static void clear()
Clears the singleton instance.
Definition singleton.h:181
static bool exist()
Checks if the singleton instance exists.
Definition singleton.h:158
singleton & operator=(const singleton &)=delete
Deleted copy assignment operator to prevent copying.
static void reset(Args &&... args)
Resets the singleton instance with new arguments.
Definition singleton.h:189
static TYPE & instance()
Provides access to the singleton instance.
Definition singleton.h:173
singleton & operator=(singleton &&)=delete
Deleted move assignment operator to prevent moving.
static void init(Args &&... args)
Initializes the singleton instance with provided arguments.
Definition singleton.h:164
Exception for invalid parameter values.
Definition error.h:219
Main namespace for the project Original.
Definition algorithms.h:21
Exclusive-ownership smart pointer implementation.