码迷,mamicode.com
首页 >  
搜索关键字:friend    ( 1299个结果
带复制构造函数、赋值运算符的模板队列
#ifndef QUEUE_HPP #define QUEUE_HPP #include #include template class Queue; template class Node{ friend class Queue; public: Node(T data = 0, Node *next = NULL) :data...
分类:其他好文   时间:2014-07-23 00:05:17    阅读次数:338
hdu 1896 Stones(优先队列)
# include # include # include using namespace std; struct node { int pos; int d; int num; friend bool operator n2.d;//仍的距离从小到大 return...
分类:其他好文   时间:2014-07-21 11:43:44    阅读次数:180
hdu 1873看病要排队(优先队列)
# include # include # include using namespace std; struct node { int y; int val; int num; friend bool operatorn2.num;//从小到大 return...
分类:其他好文   时间:2014-07-21 11:36:44    阅读次数:203
POJ 2243 || HDU 1372:Knight Moves(BFS)
Knight Moves Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11223 Accepted: 6331 Description A friend of you is doing research on the Traveling Knig...
分类:其他好文   时间:2014-07-18 23:11:51    阅读次数:276
C++友元(Friend)简单介绍
相对Java而言,友元是C++中特有的一种元素,再加上《C++ Primer》也并没有太详细的例子,所以刚接触这个概念的时候懵了很久,即是自己总结一下,也希望能帮到大家,下面来讲讲友元的用法和一些注意的地方。 操作: 1)在MyFriend类中,将Father类定义成友元 2)写一个Son类继承自Father类 3)在Father类和Son类的构造函数中分别创建MyFriend对象...
分类:编程语言   时间:2014-07-18 12:31:27    阅读次数:272
UVA 11722 - Joining with Friend(概率)
UVA 11722 - Joining with Friend 题目链接 题意:你会在[t1,t2]时刻到,你朋友会在[s1,s2]时刻到,两个人都停留w,问两人碰面的概率 思路:概率题,画图,计算围成面积/总面积就是概率 代码: #include #include int t; double t1, t2, s1, s2, w; double cal(dou...
分类:其他好文   时间:2014-07-17 15:31:30    阅读次数:262
【足迹C++primer】44、交换操作
交换操作 class HasPtr { friend void fun2(); friend void swap(HasPtr&, HasPtr&); public: // HasPtr()=default; HasPtr(const string &s=string()):ps(new string(s)), i(0){} //对ps指向的stri...
分类:编程语言   时间:2014-07-14 17:18:06    阅读次数:314
Effective C++ Item 46 需要类型转换时请为模板定义非成员函数
经验:当我们编写一个 class template, 而它所提供之"与此 template 相关的"函数支持"所有参数之隐式类型转换"时,请将那些函数定义为 "class template内部的 friend 函数"。 示例: template class Rational{ public: Rational(const T &numerator = 0, const T &denominator = 1) // Item 20 对于自定义类型以passed by referenc...
分类:编程语言   时间:2014-07-14 13:52:39    阅读次数:173
广搜深搜二
/* C - 广搜 基础 Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Description A friend of you is doing research on the Traveling Knight Problem (TKP) where you ...
分类:其他好文   时间:2014-07-13 17:29:33    阅读次数:245
广搜二
/* C - 广搜 基础 Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Description A friend of you is doing research on the Traveling Knight Problem (TKP) where you ...
分类:其他好文   时间:2014-07-13 17:09:53    阅读次数:272
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!