I looked at the DXUTCore project that ships with the DirectX March 2009 SDK and noticed that instead of using the usual access methods, they used macros to create shared accessories, as shown below:
#define GET_ACCESSOR( x, y ) inline x Get##y() { DXUTLock l; return m_state.m_##y;};
...
GET_ACCESSOR( WCHAR*, WindowTitle );
It seems that the ## operator simply inserts the text from the second argument into the macro to create a function that acts on the variable using this text. Is this standard for C ++ (i.e. not for Microsoft)? Is its use used by good practice? And what is called this operator?
source
share