/*
 * singleton.h
 *
 *  Created on: Sep 11, 2019
 *      Author: compi
 */

#ifndef SINGLETON_H_
#define SINGLETON_H_

#include <utility>

namespace f4ll_cpp {

template<typename T> class Singleton {
public:
    static T &Instance() {
        static T instance;
        return instance;
    }

protected:
    Singleton() = default;
    Singleton(const Singleton &) = delete;
    Singleton &operator=(const Singleton &) = delete;
    virtual ~Singleton() = default;
    static T *m_instance;
};

template<typename T> T* Singleton<T>::m_instance = nullptr;

}	//	f4ll_cpp

#endif /* SINGLETON_H_ */
