
C/C++
文章平均质量分 53
hnney
这个作者很懒,什么都没留下…
展开
-
原始套接字发包
#include #include #include using namespace std;#include #include #include #ifndef WIN32# include # include # include # include #else# include # include # define errno GetLastError()# pragma原创 2010-04-16 17:10:00 · 2350 阅读 · 0 评论 -
effect stl 条款1 仔细选择你的容器
<br />你知道C++中有很多你可以支配的容器,但是你意识到有多少吗?要确定你没有忽略你的选项,这里有一个快速回顾。标准STL序列容器:vector、string、deque和list。 标准STL关联容器:set、multiset、map和multimap。 非标准序列容器slist和rope。slist是一个单向链表,rope本质上是一个重型字符串。(“rope”是一个重型“string”。明白了吗?)你可以找到一个关于这些非标准(但常见的)容器的概览在条款50。 非标准关联容器hash_set、ha转载 2010-06-28 16:53:00 · 653 阅读 · 0 评论 -
dup与dup2
dup和dup2函数原型int fds = dup(oldfds);int fds = dup(oldfds,newfds);dup函数,复制oldfds至fds,dup2赋值oldfds至newfds(也可以说是将newfds重定向到oldfds),如果newfds以打开,则会关闭newfds,如果newfds等于oldfds,则直接返回newfds。close(fds) fds = dup原创 2010-05-18 16:54:00 · 1442 阅读 · 0 评论 -
c++ UML类图
转www.firnow.com 时间 : 2008-10-04 作者:佚名 编辑:本站 点击: 495 [ 评论 ]本文是我在读《大话设计模式》时的一篇读书笔记这个矩形框代表一个类,这是一个类图,它包括三层:显示类的名称,如果是抽象类,则用斜体表示。类的特性,通常为字段和属性。类的操作,通常是方法和行为。注意前面的符号:"+"表示Public,"-"表示private,"#"表示protect。这是一个接口图,与类图的主要区别是顶端有>,第一行是接口名称,第二行是接口方法。接口还有另一种表示法原创 2010-07-21 11:36:00 · 4235 阅读 · 0 评论 -
my pow
<br /> <br /><br />template< class T><br />T mypow(T a, T b) {<br /> T ret = a;<br /> for (T i=1; i<b; i++) {<br /> ret *= a;<br /> } <br /> return ret;<br />}原创 2011-01-24 11:42:00 · 999 阅读 · 0 评论 -
lower_bound 与 upper_bound
每次使用 lower_bound 和 upper_bound 的时候,总是有些模糊,有些纠结。下面我按自己理解的意思将lower_bound和upper_bound 作了一一个简单明了的比较,留个笔记。1. 函数使用 lower_bound(first, end, avl) upper_bound(first, end, avl)1. lower_bou原创 2014-03-12 15:14:17 · 777 阅读 · 0 评论