Questions tagged [singleton]
The singleton is a design pattern to ensure that exactly one application-wide instance of a particular class exists.
177 questions
4 votes
1 answer
224 views
Alpha finance trader singleton
I used to write singleton in Python, which actually Alpha only need to initialize once and the trading bot will run forever. For example in main.py: ...
0 votes
1 answer
145 views
Rust: Unsecure Static Once
I am basically a beginner, so I Wrote some code that implements a zero cost singleton, through it will crash your program if you have a MMU. ...
3 votes
1 answer
5k views
Polly AddPolicyRegistry() with factory and registered dependency injection service instances?
The Microsoft.Extensions method for Polly, to use policies via dependency injection, serviceCollection.AddPolicyRegistry() only allows to add already created ...
5 votes
2 answers
544 views
Singleton metaclass for each argument set compatible with Pickle
I am creating a metaclass which ensures that instances of an actual class A are kind of singletons. But rather than having only single instance of ...
0 votes
1 answer
992 views
Generic Meyers Singleton implementation in C++
Is this a correct implementation of a generic Meyers Singleton in C++17? Any tips appreciated. Singleton.h ...
1 vote
2 answers
2k views
Magic Static in Singleton Template
I recently was reading an article labeled "Modern C++ Singleton Template". The proposed solution used C++11 feature of Magic Statics (N2660). I wanted to adapt it for an own project in "...
0 votes
1 answer
2k views
Fast efficient C++ Singleton template with proper constructor and destruction order
I wrote a Singleton template, with examples, google tests and README https://github.com/erez-strauss/init_singleton/blob/master/singleton.h The usage can be as simple as: ...
1 vote
0 answers
64 views
Usage of global variable for dynamic value that must be declared compile time [closed]
I've been trying to make a work-around for global usage; however, I can't seem to find an alternative. I'd like to create a C++ suffix function which converts pixels to millimeters. A custom gui ...