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
5
#include "
liph/lang/make_default.h
"
6
7
namespace
liph
{
8
9
template
<
class
T>
10
struct
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_
make_default.h
liph
Definition:
algorithm.h:10
liph::singleton
Definition:
singleton.h:10
liph::singleton::instance
static T & instance()
Definition:
singleton.h:17
liph
lang
singleton.h
Generated by
1.9.4