C++/CX: Is a singleton really single?
Yes.
What is a singleton? This is not to be confused with a simpleton, that would be the author of this blog. A singleton is also referred to as a singleton pattern and limits the instantiation of a class to one time and only one time. The Singleton Pattern is classified as a Creational Pattern as it is a factory method pattern.
The code that is used to start the DirectX Shooter game or really any Windows 8 or Windows 8.1 based game is an example of an app singleton:
[Platform::MTAThread]
int main(Platform::Array<Platform::String^>^)
{
auto direct3DApplicationSource = ref new Direct3DApplicationSource();
CoreApplication::Run(direct3DApplicationSource);
return 0;
}
For more information on the idea of an app singleton take a look at the Wikipedia article:
https://en.wikipedia.org/wiki/Singleton_pattern
For C++ specific material view:
https://www.codeproject.com/Articles/1921/Singleton-Pattern-its-implementation-with-C