// stdafx.h : 标准系统包含文件的包含文件,
// 或是经常使用但不常更改的
// 特定于项目的包含文件
//

#pragma once


#define WIN32_LEAN_AND_MEAN        // 从 Windows 头中排除极少使用的资料
#include 
<stdio.h>
#include 
<tchar.h>



// TODO: 在此处引用程序需要的其他头文件
#include <iostream>
#include 
<limits>

 

 

#include "stdafx.h"
using std::cout;
using std::endl;
using namespace std;

template
<class T>
void showMinMax(){
    cout
<<"Min: "<<numeric_limits<T>::min()<<endl;
    cout
<<"Max: "<<numeric_limits<T>::max()<<endl;
}

int _tmain(int argc, _TCHAR* argv[])
{
    showMinMax
<short>();
    showMinMax
<int>();
    showMinMax
<size_t>();
    showMinMax
<float>();
    showMinMax
<double>();
    showMinMax
<long long>();
    
return 0;
}


 函数模板的好处

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-30
  • 2021-12-09
  • 2022-01-30
  • 2021-12-22
  • 2022-02-10
猜你喜欢
  • 2021-06-07
  • 2021-12-28
  • 2021-12-08
  • 2022-03-06
  • 2022-12-23
  • 2022-03-08
相关资源
相似解决方案