Dune Core Modules (2.5.0)

singleton.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_SINGLETON_HH
4#define DUNE_SINGLETON_HH
5
7
15namespace Dune
16{
52 template<class T>
54 {
55 protected:
56 /* @brief Private constructor. */
57 Singleton(){}
62
63 public:
69 {
70 static T instance_;
71 return instance_;
72 }
73 };
74
75} // namespace Dune
76
77#endif
An adapter to turn a class into a singleton.
Definition: singleton.hh:54
Singleton(const Singleton &)
Private copy constructor.
Definition: singleton.hh:59
static DUNE_EXPORT T & instance()
Get the instance of the singleton.
Definition: singleton.hh:68
Singleton & operator=(const Singleton &)
Private assignment operator.
Definition: singleton.hh:61
Dune namespace.
Definition: alignment.hh:11
Definition of macros controlling symbol visibility at the ABI level.
#define DUNE_EXPORT
Export a symbol as part of the public ABI.
Definition: visibility.hh:18
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)