Maze Builder Docs
6.7.5
Loading...
Searching...
No Matches
singleton_base.h
1
#ifndef SINGLETON_BASE_H
2
#define SINGLETON_BASE_H
3
4
#include <memory>
5
6
namespace
mazes
{
7
8
template
<
typename
T>
9
class
singleton_base
{
10
public
:
11
// Deleted copy constructor and assignment operator to prevent copying
12
singleton_base
(
const
singleton_base
&) =
delete
;
13
singleton_base
& operator=(
const
singleton_base
&) =
delete
;
14
15
// Deleted move constructor and assignment operator to prevent moving
16
singleton_base
(
singleton_base
&&) =
delete
;
17
singleton_base
& operator=(
singleton_base
&&) =
delete
;
18
19
// Static method to access the singleton instance
20
template
<
typename
...Args>
21
static
std::shared_ptr<T>& instance(Args&&...
args
)
noexcept
{
22
static
std::shared_ptr<T> instance = std::make_shared<T>(std::forward<Args>(
args
)...);
23
return
instance;
24
}
25
26
protected
:
27
// Private constructor to prevent instantiation from outside the class
28
singleton_base
() =
default
;
29
30
// Private destructor to prevent deletion from outside the class
31
virtual
~singleton_base
() =
default
;
32
};
33
34
}
// namespace mazes
35
36
#endif
// SINGLETON_BASE_H
mazes::args
Command-line argument handler with JSON support.
Definition
args.h:17
mazes::singleton_base
Definition
singleton_base.h:9
mazes
Namespace for the maze builder.
Definition
algo_interface.h:9
include
MazeBuilder
singleton_base.h
Generated by
1.12.0