随笔分类 -  C++

摘要:万分感谢 空明流转 菊苣的模板教程:https://github.com/wuye9036/CppTemplateTutorial本文就是给自己快速参阅回想用的,不一定适合别人看。#includeusingnamespacestd;templateclassAddFloatOrMulInt{stat... 阅读全文
posted @ 2015-03-31 11:15 withChengChen 阅读(362) 评论(0) 推荐(0)
摘要:那本书里面都有啊啊!!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~2015-3-17更新~~~~~~~~~~~~~~~~~~~先上两个解释我的疑惑的链接:http://en.cppreference.com/w/cpp/language/operator_arithmeti... 阅读全文
posted @ 2015-03-17 18:34 withChengChen 阅读(268) 评论(0) 推荐(0)
摘要://vs2013 32位win8 coutd(1);coutv(1);cout只存储bit而非 字节序? 阅读全文
posted @ 2014-12-31 20:29 withChengChen 阅读(209) 评论(0) 推荐(0)
摘要://编译环境:vs201332位win8操作系统#include#include#includeusingstd::cout;usingstd::endl;classA{intx=0;public:A();~A();private:};A::A(){}A::~A(){}intmain(){std::... 阅读全文
posted @ 2014-12-31 16:05 withChengChen
摘要:Template Metaprogramming八皇后 小练习http://accu.org/index.php/journals/424http://isocpp.org/blog/2014/12/cpp-template-metaprogramming 阅读全文
posted @ 2014-12-30 18:23 withChengChen
摘要:转载自http://www.stroustrup.com/C++11FAQ.html仅供个人参考, 收藏用control of defaults: move and copyBy default, a class has 5 operations:copy assignmentcopy constr... 阅读全文
posted @ 2014-12-30 16:08 withChengChen 阅读(231) 评论(0) 推荐(0)
摘要:用一年时间如何能掌握 C++ ?修改有一定 C 语言基础,日后想从事游戏开发等工作,给自己一年时间,能在此期间精通 C++ 吗?Milo Yip,游戏程序员、《游戏引擎架构》译者张麦克、什么、乘风者等人赞同本人大约从20多年前开始学习及使用C++,但仍未达到我认为「精通」的阶段,甚至对于C++11的... 阅读全文
posted @ 2014-12-22 22:52 withChengChen 阅读(3360) 评论(0) 推荐(0)
摘要:C++中规定, 一个类中member variable的初始化顺序和他们在类中被声明的顺序(而不是在构造函数中使用的顺序)最好是一致的.下面看一个违反规则而发生错误的例子. 阅读全文
posted @ 2014-10-12 00:00 withChengChen 阅读(159) 评论(0) 推荐(0)
摘要:#include#includeusingnamespacestd;classA{private:intdata;//dataint*pi;//pointtodatapublic://禁止隐式转换A(){data=0;pi=&data;}~A(){data=-999999;pi=nullptr;}e... 阅读全文
posted @ 2014-09-28 17:35 withChengChen 阅读(306) 评论(0) 推荐(0)
摘要:C++11支持移动语义。一:为什么需要移动语义和什么是移动语义我们先来看看C++11之前的复制过程。假设有下列代码:vector v1(1000000);//v1存放着100W个string,假设每个string长度为1000vector v2(v1);//使用v1初始化v2vector和strin... 阅读全文
posted @ 2014-09-24 16:20 withChengChen 阅读(2810) 评论(0) 推荐(0)
摘要:#include#include#include//_Tusingnamespacestd;intmain(){/*strings0="学正楼";cout<<s0[0];cout<<s0[1]<<endl;*///wcout.imbue(locale("chs",locale::ctype));//... 阅读全文
posted @ 2014-09-04 21:10 withChengChen 阅读(5843) 评论(0) 推荐(0)
摘要:#includeusingnamespacestd;int*returndie() // 除了地址为a的,a以后的都死了{inta[4]={1,2,3,4};returna;}intmain(){autoa=returndie();for(size_ti=0;i<4;i++){cout<<a[i... 阅读全文
posted @ 2014-09-03 23:11 withChengChen 阅读(135) 评论(0) 推荐(0)
摘要:classGraph{protected:size_tnumVertex=0,numEdge=0;public:virtualsize_tn()=0;//返回顶点数virtualsize_te()=0;//返回目前的边数virtualintfirst(size_t)=0;//返回第一个neighbo... 阅读全文
posted @ 2014-09-03 17:32 withChengChen 阅读(350) 评论(0) 推荐(0)
摘要:菜单栏里的 工具-》编译选项-》 阅读全文
posted @ 2014-08-31 09:35 withChengChen
摘要:assert(fin != NULL && fout != NULL); 是一个断言,在debug模式下,当fin或者fout其中一个为空时,程序就会被断下,弹出一个断言窗口,表示这两个变量中的一个或则两个为空,程序有异常。 下面的注释是说明fin这个变量必须是一个输入一个完整的文本,文本内容必须为... 阅读全文
posted @ 2014-04-18 23:21 withChengChen 阅读(549) 评论(0) 推荐(0)