![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
我与编程有个约定
这个作者很懒,什么都没留下…
展开
-
C++中异常类的使用方法
C++有很多的标准异常类:namespace std{ //exception派生 class logic_error; //逻辑错误,在程序运行前可以检测出来 //logic_error派生 class domain_error; //违反了前置条件 class invalid_argumen原创 2014-06-05 10:04:14 · 424 阅读 · 0 评论 -
【C++Primer Ch5表达式】类型转换:显示转换
显示转换也称强制转换,有四种:static_cast、dynamic_cast、const_cast和reinterpret_cast。用法:cast-name( expression ),expresssion是强制转换的值。虽然有时需要强制转换,但它们本质上都是非常危险的,如使用const_cast总是预示着设计缺陷。(1)static_cast总结:static_cast是C原创 2014-06-26 16:00:48 · 535 阅读 · 0 评论 -
【第10章 关联容器】hashtable, hash_map, hash_set, hash_multiset, hash_multimap基于hashtable
set(集合)、 map(映射表)、 multiset(多键集合) 、multimap(多键映射表),这些容器均以RB-tree完成(是一种比较均衡的二叉树); hash_set(散列集合)、hash_map(散列映射表)、hash_multiset(散列多键集合)、hash_multimap(散列多键映射表)是以hashtable(散列表--一种链表数组)为底层机制完成。原创 2014-06-12 16:33:30 · 505 阅读 · 0 评论 -
【第10章 关联容器】多关键字Map_Set实例
(1)排序准则map中的key默认是以less也就是说key必须具备operator(2)find准则map在插入、查找、排序时,实际调用原创 2014-06-12 16:23:53 · 480 阅读 · 0 评论 -
程序测试C程序内存空间布局
本短文通过实际的程序测试,来验证程序各段在运行时内存中的分布情况;经过测试证明,自低地址向高地址依次为:(1)文本段(存代码)(2)数据段(存初始化的全局变量)(3)bss段(存未初始化的全局变量)(4)堆(动态分配内存)(5)栈(函数内部局部变量)另外,字符串常量存放在(1)和(2)之间,共享内存存放在(4)和(5)之间。原创 2014-06-05 10:08:16 · 638 阅读 · 0 评论 -
string的find函数,返回下标,当不存在时返回string::npos,为无符号数最大值
#include #include #include #include #include #include #include #include using namespace std;int main( void ){ string str("abc"); string::size_type i = str.find( "d" ); cout << "i=" <<原创 2014-06-11 11:18:55 · 811 阅读 · 0 评论 -
不能将参数 1 从“int &(__thiscall RBTree<T>::* )(RBTreeNode<T> *)”转换为“int &(__cdecl *)(RBTreeNode<T> *)”
thiscall仅仅应用于“C++”成员函数。this指针存放于CX/ECX寄存器中,参数从右到左压。thiscall不是关键词,因此不能被程序员指定。 __cdecl C调用约定(即用__cdecl关键字说明)(The C default calling convention)按从右至左的顺序压参数入栈,由调用者把参数弹出栈。对于传送参数的内存栈是由调用者来维护的(正因为如此,实现可变参原创 2014-06-16 11:25:35 · 1347 阅读 · 0 评论 -
如何实现一个malloc:【来源】博客园
具体地址:http://kb.cnblogs.com/page/512454/这是一个神奇的网站,有空注册一下,多学习下上面的代码!!!原创 2015-01-12 15:09:35 · 499 阅读 · 0 评论 -
Linux signal() 信号处理函数
http://www.cnblogs.com/wblyuyang/archive/2012/11/13/2768923.htmlhttp://blog.chinaunix.net/uid-25100840-id-307217.html原创 2015-09-17 16:04:50 · 497 阅读 · 0 评论