Loading...
Searching...
No Matches
singleton.hh
Go to the documentation of this file.
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
#ifndef DUNE_SINGLETON_HH
#define DUNE_SINGLETON_HH
#include <dune/common/visibility.hh>
namespace Dune
{
template<class T>
class Singleton
{
protected:
/* @brief Protected constructor. */
Singleton() = default;
public:
Singleton(const Singleton&) = delete;
void operator=(const Singleton&) = delete;
DUNE_EXPORT static T& instance()
{
static T instance_;
return instance_;
}
};
} // namespace Dune
#endif
visibility.hh
Definition of macros controlling symbol visibility at the ABI level.
DUNE_EXPORT
#define DUNE_EXPORT
Export a symbol as part of the public ABI.
Definition visibility.hh:20
Dune
Dune namespace
Definition alignedallocator.hh:13
Dune::Singleton::Singleton
Singleton()=default
Dune::Singleton::Singleton
Singleton(const Singleton &)=delete
Dune::Singleton::operator=
void operator=(const Singleton &)=delete
Dune::Singleton::instance
static DUNE_EXPORT T & instance()
Get the instance of the singleton.
Definition singleton.hh:70