-
-
Save joncham/6554128 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TemplateTester.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
template<class T> struct Converter {}; | |
struct TheMagicTypeToFind {}; | |
struct MyConverter : Converter<TheMagicTypeToFind> //I want to store the magic type here | |
{ | |
typedef TheMagicTypeToFind ThisTheMagicTypeYouWant; | |
void DoSomething() {} | |
}; | |
template<class TConverter> | |
static void MyFunc(TConverter converter) | |
{ | |
TConverter::ThisTheMagicTypeYouWant magic; | |
converter.DoSomething(); | |
} | |
static void Main() | |
{ | |
MyConverter converter; | |
MyFunc(converter); | |
} | |
int _tmain(int argc, _TCHAR* argv[]) | |
{ | |
Main(); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment