摘要: c标准库的是不行,1970年之前虽int变量可设负值,但运算不行。 //#include////int GetTimeSpan()//{// long ttt = timezone;// __time64_t timeGet;//1383625542// _time64(&timeGet);// // __time64_t timeComp(333);//// double dVvv = _dif... 阅读全文
posted @ 2013-11-05 16:13 xiarunliang 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 想生成一堆随机数,看看库中新的方法是哪个。看到一个类似这样的写法: vector vdT; vector viT; bernoulli_distribution blObj; uniform_int uniftt(1,999); uniform_int unnnifttf(1,999);// random_device rdObj; mt19937 eng; for (int indextt10... 阅读全文
posted @ 2013-10-23 14:04 xiarunliang 阅读(289) 评论(1) 推荐(0) 编辑
摘要: 如下代码:struct Derived{ void foo(string) { cout<<"ddd foo"<<endl; }; void foo(string) const { cout<<"ddd foo const"<<endl; };}; int _tmain(int argc, TCHAR * argv[]){ Derived dttt; dttt.foo("xiarl");//ddd... 阅读全文
posted @ 2013-10-08 10:06 xiarunliang 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 摘自 effective c++ // TODO 条款48 Be aware of template metaprogramming. // [9/29/2013 xiarl] templatestruct Factorial{ enum { value = n* Factorial::value };}; templatestruct Factorial{ enum { value = 1 };... 阅读全文
posted @ 2013-09-29 14:18 xiarunliang 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 测试代码如下: class bbbase1357{public: explicit bbbase1357( int ii) :m_ivalue(ii) { }private: int m_ivalue;}; class ddderived1357 :public bbbase1357{public: ddderived1357() :bbbase1357(9) { }}; union unTe... 阅读全文
posted @ 2013-09-27 14:54 xiarunliang 阅读(376) 评论(0) 推荐(0) 编辑
摘要: 不能重载的操作符有 ::、.*、.、?: 参见《c++primer》第四版14.1,p430 阅读全文
posted @ 2013-09-27 14:03 xiarunliang 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 怎么解释呢?首先,private,私有的,这是绝对的,不会受继承而变化,只对本类(即使是基类)可见。剩下的public和 protected 成员,三种继承,2×3 = 6。私有继承在派生类中全为私有,保护继承在派生类中全为保护,公有继承,不改变原本性质。 阅读全文
posted @ 2013-09-27 10:03 xiarunliang 阅读(116) 评论(0) 推荐(0) 编辑