C++判断模板类型

  1 #include <iostream>
  2 #include <type_traits>
  3 using namespace std;
  4 template<typename T>
  5 void test(T a)
  6 {
    
    
  7         cout<<std::is_same<T,int>::value<<endl;
  8 
  9 }
 10 int main()
 11 {
    
    
 12         double a = 4;
 13         test(a);
 14         return 0;
 15 }

c11才支持is_same。

猜你喜欢

转载自blog.csdn.net/sinat_36304757/article/details/116743930
今日推荐