singleton.hpp
Go to the documentation of this file.
1 
13 /*****************************************************************************
14 ** Ifdefs
15 *****************************************************************************/
16 
17 #ifndef ECL_UTILITIES_SINGLETON_HPP_
18 #define ECL_UTILITIES_SINGLETON_HPP_
19 
20 /*****************************************************************************
21 ** Namespaces
22 *****************************************************************************/
23 
24 namespace ecl {
25 
26 /*****************************************************************************
27 ** Class [Singleton]
28 *****************************************************************************/
51 template<typename T> class Singleton
52 {
53  public:
59  static T& instance()
60  {
61  static T the_single_instance; // assumes T has a protected default constructor
62  return the_single_instance;
63  }
64 
65  virtual ~Singleton () {}
66 };
67 
68 }; // namespace ecl
69 
70 #endif /*ECL_UTILITIES_SINGLETON_HPP_*/
Embedded control libraries.
virtual ~Singleton()
Definition: singleton.hpp:65
static T & instance()
Definition: singleton.hpp:59
Singleton construction via the curiously recurring template pattern.
Definition: singleton.hpp:51


ecl_utilities
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:08:28