LIPH's C++ Codes
singleton.h
Go to the documentation of this file.
1#ifndef LIPH_LANG_SINGLETON_H_
2#define LIPH_LANG_SINGLETON_H_
3
4// #include <utility> // std::forward
6
7namespace liph {
8
9template <class T>
10struct singleton {
11 // template <class... Args>
12 // static T& instance(Args&&...args) {
13 // static T obj(std::forward<Args>(args)...);
14 // return obj;
15 // }
16
17 static T& instance() {
18 static T obj = make_default<T>();
19 return obj;
20 }
21};
22
23} // namespace liph
24
25#endif // LIPH_LANG_SINGLETON_H_
Definition: algorithm.h:10
Definition: singleton.h:10
static T & instance()
Definition: singleton.h:17