c++模板特化
来源:互联网 发布:淘宝降价提醒助手 编辑:程序博客网 时间:2024/06/18 12:49
// template specialization#include <iostream>using namespace std;// class template:template <class T>class mycontainer { T element; public: mycontainer (T arg) {element=arg;} T increase () {return ++element;}};// class template specialization:template <>class mycontainer <char> { char element; public: mycontainer (char arg) {element=arg;} char uppercase () { if ((element>='a')&&(element<='z')){ element+='A'-'a';} return element; }};int main () { mycontainer<int> myint (7); mycontainer<char> mychar ('j'); cout << myint.increase() << endl; cout << mychar.uppercase() << endl; return 0;}
阅读全文
0 0
- 【c++】模板的特化
- C++—模板特化和偏特化
- 【C++】模板类、特化以及偏特化!!!
- Linux C/C++ 模板:主模板、完全特化、局部特化
- C++:函数模板、类模板及其特化
- C++——模板特化和偏特化
- C++——模板特化和偏特化
- C++——模板特化和偏特化
- C++——模板特化和偏特化
- C++模板的特化
- C++模板的特化
- 模板特化
- 模板特化
- 模板特化
- 模板特化
- 模板特化
- 模板特化
- 模板特化
- 字符过滤器工具类
- 解决Failed to ... maven-compiler-plugin:3.1:compile (default-compile) on project ...
- GoLang初探
- Mardown使用方法
- SVM学习资料链接
- c++模板特化
- 武大杨必胜老师论文-移动测量
- 癌症基因组遗传和表观遗传数据整合分析
- Java工程师的一些面试总结(7)
- Linux system 系统虚拟机管理及其安装、重置的简单脚本
- 加密
- 蓝桥杯--三部排序
- PullToRefresh使用详解(五)--下拉刷新的ScrollView
- 从淘宝API根据IP获取IP城市信息