#include <iostream>
class Singleton {
private:
Singleton(const int value) : m_value(value) {}
int m_value = 0;
public:
Singleton(const Singleton& other) = delete;
void operator=(const Singleton&) = delete;
static Singleton& getInstance(const int value);
int getValue() {
return m_value;
}
};
Singleton& Singleton::getInstance(const int value) {
static Singleton instance(value);
return instance;
}
int main() {
Singleton& singleton = Singleton::getInstance(42);
std::cout << "Singleton value: " << singleton.getValue() << std::endl;
return 0;
}