从__type_traits知道的c++的一种用法

#include<stdio.h>
#include<iostream>
using namespace std;
class True
{
};
class False
{
};

int fun(int a,int b,True)
{
	return a+b;
}
int fun(int a,int b,False)
{
	return a-b;
}
void main()
{
	typedef True my1;
	typedef False my2;
	cout<<fun(4,5,my1())<<endl;
	cout<<fun(4,5,my2())<<endl;
}


 

你可能感兴趣的:(C++,Class,fun)