
c++
mason12334434
这个作者很懒,什么都没留下…
展开
-
测试成员函数指针大小
namespace pointer_to_member_func { struct A { void foo() const { std::cout } char pad0[32];}; struct B { void bar() const { std::cout }原创 2016-05-30 08:09:24 · 497 阅读 · 0 评论 -
What's wrong with the string class defined by the draft standard?
Strings in SGI STLThis is an attempt to answer some of the questions related to the use of strings with SGI STL.What's wrong with the string class defined by the draft standard?There are several转载 2016-06-22 13:05:13 · 310 阅读 · 0 评论 -
多机数据处理实践
一、多机数据处理。有 10 台机器,每台机器上保存着 10 亿个 64-bit 整数(不一定刚好 10 亿个,可能有上下几千万的浮动),一共约 100 亿个整数(其实一共也就 80GB 数据,不算大,选这个量级是考虑了 VPS 虚拟机的容量,便于实验)。编程求出: 1. 这些数的平均数。 2. 这些数的中位数。 3. 出现次数最多的 100 万个数。 *4. (附加题)对这 100 亿个整数原创 2016-06-14 10:08:27 · 953 阅读 · 0 评论 -
指针计算
验证图片中的问题: 这里写图片描述 int *a=new int(10); int *b=new int(20); cout<<"a="<<hex<<a<<endl; cout<<"b="<<hex<<b<<endl; a=(int*)(b-a);原创 2016-06-13 16:53:46 · 277 阅读 · 0 评论 -
关于gcc中string的sizeof
class test_string { struct _Rep_base { int* _M_length; int* _M_capacity; int* _M_refcount; }; struct _Alloc_hider {原创 2016-06-13 13:35:46 · 335 阅读 · 0 评论 -
关于operator new及placement new,和相关的delete重载
class Fruit { int no; double weight; char key; public: void print() { } virtual void process(){ } };// class Apple: public Fruit // { // int size; // char type; //原创 2016-06-03 09:57:19 · 383 阅读 · 0 评论 -
关于const
此定义的问题: 1、参数定义的两个const都是修饰的int,属于重复定义 2、一般内建类型不需要定义为引用 3、返回值为引用,注意定义的时候不要返回临时值 还要注意const一般不修饰&,引用默认为const,不需要显式修饰原创 2016-06-08 10:38:41 · 259 阅读 · 0 评论 -
类大小总结
namespace test_class_size { class A { public: protected: private: }; class B{ public: protected: private: }; class C:public A,public B{ public: protected: private:原创 2016-05-31 14:13:29 · 264 阅读 · 0 评论 -
关于class 类大小的总结
namespace test_class_size { class A { public: protected: private: }; class B{ public: protected: private: }; class C:public A,public B{ public: prote转载 2016-05-31 13:58:54 · 531 阅读 · 0 评论 -
成员函数16字节的使用
namespace pointer_to_member_func { struct A { void foo() const { std::cout << “A’s this:\t” << this << std::endl; } char原创 2016-05-31 13:19:54 · 358 阅读 · 0 评论 -
输出异常
欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦:Markdown和扩展Markdown简洁的语法代码块高亮图片链接和图片上传LaTex数学公式UML序列图和流程图离线写博客导入导出Markdown文件丰富的快捷键快捷键加粗 Ctrl + B 斜体 Ctrl + I 引用 Ctrl原创 2016-08-11 11:03:56 · 307 阅读 · 0 评论