If I were to run this code, would the program create hundreds of pointers? (I am aware that only one singleton will be created).
while(true)
{
ClassName* instanceName = ClassName::getSingleton();
}
Someone told me that if I wanted to only wanted to create the pointer on the first iteration of the while loop, I would have to change it to:
while(true)
{
static ClassName* instanceName = ClassName::getSingleton();
}
Is that true?