I recently acquired some code that I want to port to Linux. In a header file though, I have some curious code that I hope someone can shed some light on. Within a header file, inside a namespace where other classes are defined, I have the following:
#define CREATE_SINGLETON_METHODS(s) \
private: \
friend class Singleton<c>; \
##c(); \
virtual ~##c();
I understand that the ##
is the token pasting operation, but I can't figure out why the original author (who I don't know, and can't contact) used it. I have an implementation class that looks like this:
class MapManager : public Singleton<MapManager> {
CREATE_SINGLETON_METHODS(MapManager)
private:
...
When I compile, I get the following error:
error: pasting ";" and "MapManager" does not give a valid preprocessing token
This compiles find on Windows and some earlier versions of gcc (pre 4.x). Any ideas as to what could be going on here? Thanks!