Skip to content

Instantly share code, notes, and snippets.

@thlgood
Created May 14, 2013 06:07
Show Gist options
  • Save thlgood/5574022 to your computer and use it in GitHub Desktop.
Save thlgood/5574022 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
template<typename T>
struct hello
{
void operator()(T& x)
{
cout << "What the F_CK:" << x << endl;
}
};
template<typename T, typename T1>
void func(T& x, T1& f)
{
f(x);
}
int main(void)
{
int param = 10;
func(param, hello<int>());
return 0;
}
@sqbing
Copy link

sqbing commented May 14, 2013

include

using namespace std;

template
struct hello
{
void operator()(T& x)
{
cout << "What the F_CK:" << x << endl;
}
};

template<typename T, typename T1>
void func(T& x, T1& f)
{
f(x);
}

int main(void)
{
int param = 10;
hello func_inst;
func(param, func_inst);
return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment