Skip to content

Instantly share code, notes, and snippets.

@joncham
Forked from lucasmeijer/gist:6554039
Created September 13, 2013 18:13
Show Gist options
  • Save joncham/6554128 to your computer and use it in GitHub Desktop.
Save joncham/6554128 to your computer and use it in GitHub Desktop.
// 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