Skip to content

Instantly share code, notes, and snippets.

@caryhaynie
Created June 25, 2012 18:12
Show Gist options
  • Select an option

  • Save caryhaynie/2990287 to your computer and use it in GitHub Desktop.

Select an option

Save caryhaynie/2990287 to your computer and use it in GitHub Desktop.
Example
template <typename T>
class BasePlatform {};
class SDLPlatform : BasePlatform<SDLPlatform> {};
class Win32Platform : BasePlatform<Win32Platform> {};
#ifdef USE_WINDERS
typedef Win32Platform Platform;
#else
typedef SDLPlatform Platform;
#endif
// Then the user just calls:
// Platform p;
// and gets the correct thing at compile time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment