Still on the subject of Singletons (their usage)
Never thought I'd ask this. Since most texts about the singleton pattern focus on its implementation, it hardly occurred to me that I would be facing dilemas concerning their actual usage.
GameMap is a GoF Singleton returning a reference through getInstance(). The problem is that I'm really not sure what to do with its copy constructor and assignment operator.
My first thought was to explicitly declare them in order to make it clear to users of the class they can use them. GameMap implements a vector of hexagons and is meant to be used in various contexts by other objects and routines.
Because of this, I believe it is more practical to write:
GameMap myMap = GameMap::getInstance();
Than it is to make copy-control private and have to write something like the following everytime I need to access the container's contents interface:
At best I can simplify a bit by renaming getInstance() to Map(), for instance. But still feels awkward to rely on a temporary all the time.
I see too much singleton implementations moving copy-control to the private portion of the class definition. So, i'm a little shaky about not doing it. Should I?