1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
---|---|
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #ifndef SINGLETON_H |
6 | #define SINGLETON_H |
7 | |
8 | template<typename T> |
9 | class Singleton |
10 | { |
11 | public: |
12 | static T *instance() { |
13 | static T instance; |
14 | return &instance; |
15 | } |
16 | |
17 | private: |
18 | Singleton(); |
19 | ~Singleton(); |
20 | Singleton(const Singleton &); |
21 | Singleton & operator = (const Singleton &); |
22 | }; |
23 | |
24 | #endif // SINGLETON_H |
25 |