Program Listing for File singleton.hpp
↰ Return to documentation for file (rcppsw/patterns/singleton/singleton.hpp
)
#pragma once
/*******************************************************************************
* Includes
******************************************************************************/
#include "rcppsw/rcppsw.hpp"
/*******************************************************************************
* Namespaces/Decls
******************************************************************************/
namespace rcppsw::patterns::singleton {
/*******************************************************************************
* Class Definitions
******************************************************************************/
template <class T>
class singleton {
public:
static T& instance() {
static T inst;
return inst;
}
singleton(singleton const&) = delete;
singleton& operator=(singleton const&) = delete;
singleton(singleton&&) = delete;
singleton& operator=(singleton&&) = delete;
protected:
singleton(void) = default;
~singleton(void) = default;
};
} /* namespace rcppsw::patterns::singleton */