template友元的写法
来源:互联网 发布:json 遍历取值 编辑:程序博客网 时间:2024/04/28 21:29
#include<iostream>
using namespace std;
template<class T>
class test;
template<class T>
ostream& operator<<(ostream& os,const test<T>& src);
template<class T>
class test
{
T m;
public:
test(T i):m(i){}
friend ostream& operator<<<>(ostream& os,const test<T>& src);
};
template<class T>
ostream& operator<< (ostream& os,const test<T>& src)
{
os<<"operator<<"<<src.m;
return os;
}
int main()
{
test<int> x(10);
cout<<x<<endl;
return 0;
}
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/akirya/archive/2008/06/04/2509791.aspx
- template友元的写法
- Vue2 模板template的四种写法
- C++ - 类模板(class template)友元(friend) 的 全部六种形式 及 代码
- 类模板(class template)友元(friend) 的全部六种形式及代码
- 模板类中的友元函数写法
- C++ Template 基础篇(四):模板与友元
- C++程序设计语言练习11.4 算术运算符重载的友元写法
- 【c++】友元关系和子类函数构造函数的写法
- 关于c++的class(偏c++11以前,构造、静态成员、const、初始化列表、友元、内联、template)
- 求乘法逆元的三种写法
- TMP(Template metaprogramming)模板元编程的起手程序:编译期计算阶乘
- C++模板元程序 Template Metaprograms
- 条款48:认识template元编程
- 条款48:认识template元编
- 通过factorial认识template元编程
- C++template元编程学习心得--数据类型
- C++template元编程学习心得-switch结构
- 条款48:认识template元编程
- Flex中如何利用isBranch()事件,检测Tree的节点是支节点还是叶子节点
- JOJ 1119 1121
- [ford-fulkerson] 利用残量图求解最大流
- 项目经理所应具备的八项素质:
- Flex中如何利用openItems属性,检测当前Tree的哪一个节点被展开
- template友元的写法
- ADO.NET的连接式和断开式
- 随拍西华校园(组图)
- Flex中如何利用firstVisibleItem属性,设置或取得第一个显示节点
- sscanf sprintf
- 十句话,不黄不色,但很经典~~~~~~~~~~
- Flex中如何利用expandItem()和expandChildrenOf()展开,或关闭Tree的各层节点
- Hibernate学习笔记find及iterate(转)
- Flex中如何将一个数组Array作为Tree的数据提供元