I am working in a C++11 solution, for Linux (Ubuntu 14.04; then I should need to migrate it to REL). I am using g++4.8 compiler (and I should probably be required to compile using Intel compiler).
But, please, focus on C++11 / Ubuntu 14.04 / g++4.8.
There are lots of Singleton implementations in the Web.
But it has been hard (and without success...) for me finding something like this:
Ideal solution:
A generic (template)Singleton, from where I can inherit my classes which containSTL containers.Acceptable solution:
An "ad hoc"Singletonfor each class withSTL containers."May be" possible solution:
I am aware of the discussions aboutconstandconstexprvsSingleton. But my managers are quite outdated. And they want aSingletonsolution. But I think if I can provide a solution usingconst/constexprwould be acceptable.
Problem: The found solutions let me have a Singleton. But this Singleton not only avoid creating new instances of the class (which is my goal: only one instance), but also avoid inserting new elements in the STL containers (this is not desired at all).
So, I am looking for a Singleton + STL containers implementation:
- which limits the created instances to only one.
- which lets me add as many elements as I want in the
queue, vector, set, map, list, array, and so forth, containers which belongs to the unique created object.