python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
What is the difference between a singleton and a module that instantiates an instance?
I want to add a metrics class to my code. What is the difference between
class MyMetrics {
constructor () {
if (!Singleton.instance) {
Singleton.instance = new Metrics()
}
return S...
geezer234
Votes: 0
Answers: 1
Pytest: Incorrect behavior for singletons across processes
I had asked a question about singletons in different processes here: Singleton has same address in multiple processes, but behaves like separate objects
I wrote a test that I expected to fail. But is ...
lo tolmencre
Votes: 0
Answers: 1
Singleton has same address in multiple processes, but behaves like separate objects
I figured instantiating a singleton across different processes would result in different objects, so that the singleton would only be local to its own process. To validate this, I wrote a test:
def v1...
lo tolmencre
Votes: 0
Answers: 3
How to create a singleton object using std::unique_ptr of a class with private destructor?
How to create a singleton class using std::unique_ptr? My current implementation makes use of a static function get_instance() for initializing the std::unique_ptr. I'm using std::once_flag and std::c...
Harry
Votes: 0
Answers: 0