[ create a new paste ] login | about

Link: http://codepad.org/uoli1zcV    [ raw code | output | fork ]

hecomi - C++, pasted on Feb 9:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>

template <class R>
class Convert;

template <class R, class T>
class Convert<R (T)>
{
public:
	R operator()(T arg)
	{
		return static_cast<R>(arg);
	}
};

int main()
{
	Convert<int(float)> floor;
	std::cout << floor(3.14159) << std::endl;
	return 0;
}


Output:
1
3


Create a new paste based on this one


Comments: