DUNE PDELab (2.8)

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 Protected constructor. */
57 Singleton() = default;
58
59 public:
60
61 Singleton(const Singleton&) = delete;
62 void operator=(const Singleton&) = delete;
63
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
static DUNE_EXPORT T & instance()
Get the instance of the singleton.
Definition: singleton.hh:68
Dune namespace.
Definition: alignedallocator.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 (Dec 21, 23:30, 2024)