@C++
GeoAnt
这个作者很懒,什么都没留下…
展开
-
C++ 中的 protected
C++ 中的 protected class exception : public std::exception { public: exception(const exception& exception_) : message(exception_.message) {} exception(const st转载 2013-08-24 21:24:11 · 572 阅读 · 0 评论 -
Policy-based design设计模式
书在4年前看过,今天重温一下:一直认为这是最好的设计模式,大牛Andrei Alexandrescu 专门写了书,可见他的重要性http://en.wikipedia.org/wiki/Policy-based_designtemplate <class T>class Talkative { T const & t;public: Talkative(T const & obj) : t(obj) { } void talk() const { t.talk(); }};原创 2014-10-26 11:33:15 · 1658 阅读 · 0 评论 -
#ifdef __cplusplus 倒底是什么意思?
一直没搞C,C#ifdef __cplusplus 倒底是什么意思?转载 2014-09-28 23:37:37 · 542 阅读 · 0 评论 -
static 中的 C++使用权与生存期
#include int main(){ using namespace std; {int n;n=5;} cout<<n; system("pause"); return 0;}原创 2014-06-19 10:58:31 · 589 阅读 · 0 评论 -
多维数组怎样快速索引
Table of ContentsHow to create a multi-dimensional arrayHow to loop through a multi-dimensional arrayMethod 1: Nested loops with multiple arraysMethod 2: Nested loops with linear arr转载 2014-08-03 02:48:32 · 789 阅读 · 0 评论 -
[1-9]Profiling Code Using clock_gettime
Keeping track of what I doProfiling Code Usingclock_gettime:http://www.guyrutenberg.com/2007/09/22/profiling-code-using-clock_gettime/with 45 commentsAfter raising the issue of the low r转载 2013-07-27 15:33:37 · 642 阅读 · 0 评论 -
debug 记录(1)
一行程序错误,debug两小时千万不要在饭乱的时候debug, 没有原创 2014-07-01 10:17:03 · 403 阅读 · 0 评论 -
fstream读写创建可能不存在的文件
You're specifying std::fstream::in in your call to fstream::open(). This is known to force it to require an existing file.If you look at e.g. this reference, you will see:app seek原创 2013-12-03 18:23:35 · 10747 阅读 · 0 评论 -
on std::numeric_limits<float>=1.192e-7
Assuming 64-bit IEEE double, there is a 52-bit mantissa and 11-bit exponent. Look at the following numbers:1.0000 00000000 00000000 00000000 00000000 00000000 00000000 × 2^0 = 1The smallest repr翻译 2014-04-10 11:19:50 · 897 阅读 · 0 评论 -
C/C++文件之eof()误区
http://www.google.com.hk/#newwindow=1&q=c%2B%2B+eof+&safe=strictC/C++文件之eof()原创 2013-12-03 17:46:24 · 1007 阅读 · 0 评论 -
C++库研究笔记——#if #elif 的错误使用
在了跟头,无论is_ar为多少,始终输出 "not"template//ant::is_arithmetic::value >class Test{public: void test() {#if is_ar cout<<"is\n";#elif !is_ar cout<<"not\n";#endif cout<<"is_arr="<<原创 2013-09-29 02:17:51 · 2116 阅读 · 0 评论 -
C++ 库研究笔记——通过inline避免hpp 的mutiple definition 错误
报错:// foo.hppvoid foo() { /* body */ }// a.cpp#include "foo.hpp"// b.cpp#include "foo.hpp"翻译 2013-09-10 16:24:08 · 897 阅读 · 0 评论 -
char与unsigned char 区别
char 与 unsigned char的本质区别http://bbs.csdn.net/topics/270080484同一个内存内容:10010000 你用char* 解释是-112 你用unsigned char* 解释是144 还是同样这个内存内容赋给整型值,用unsigned char 类型还是会得到144,用c原创 2014-10-01 05:18:20 · 1230 阅读 · 0 评论