GaitGeneration by Graph Search
読み取り中…
検索中…
一致する文字列を見つけられません
singleton.h
[詳解]
1
3
4// Copyright(c) 2023-2025 Design Engineering Laboratory, Saitama University
5// Released under the MIT license
6// https://opensource.org/licenses/mit-license.php
7
8#ifndef DESIGNLAB_SINGLETON_H_
9#define DESIGNLAB_SINGLETON_H_
10
11
12namespace designlab
13{
14
26template <typename _T>
28{
29public:
34 static _T* GetIns()
35 {
36 static _T inst;
37 return &inst;
38 };
39
40protected:
43 Singleton() = default;
44 virtual ~Singleton() = default;
45 Singleton(const Singleton& r) = default;
46 Singleton& operator=(const Singleton& r) = default;
47};
48
49} // namespace designlab
50
51
52#endif // DESIGNLAB_SINGLETON_H_
Singletonクラス作成のためのテンプレートクラス.
Definition singleton.h:28
static _T * GetIns()
インスタンスを取得する. このクラスを継承したクラスは クラス名::getIns()-> の形式でメンバ関数を呼び出す.
Definition singleton.h:34
virtual ~Singleton()=default
Singleton & operator=(const Singleton &r)=default
Singleton(const Singleton &r)=default