2013年3月24日

auto_ptr的不足

摘要: 一开始还发现这货挺方便的.后来才发现还是不行,多引用时,就会重复删除了#include <iostream>#include <memory>using namespace std;void func(const auto_ptr<int>& pInt){ cout << *pInt<<endl;}class X{public: X(){cout <<"construct"<<endl;} ~ X(){cout <<"destructor"<&l 阅读全文

posted @ 2013-03-24 23:47 Orz.. 阅读(213) 评论(0) 推荐(0)

王垠:无题

摘要: from: http://news.cnblogs.com/n/174034/在之前的几篇博文里面,我多次提到了 Lisp,它相对于其它语言的优势,以及 Lisp Machine 相对于 Unix 的优点。于是有人来信请教我如何学习 Lisp,也有人问我为什么 Lisp Machine 没有“流行”起来。我感觉到了他们言语中对 Lisp 的敬畏和好奇心,但也感觉到了一些隐含的怀疑和嘲讽。 这是一种复杂的感觉,仿佛我在原始人的部落兜售一些原子能小玩具,却被人当成了来自天外的传教士。敬畏和奉承,并不能引起我的好感。怀疑和嘲讽,也不能引起我的不平。当我看到有人说“别听他误导群众,学那些语言是找不到. 阅读全文

posted @ 2013-03-24 22:25 Orz.. 阅读(448) 评论(0) 推荐(0)

boost 程序库完全开发指南_date_time

摘要: 下面是看boost 程序库完全开发指南时,date_time(chapter2)时所敲下的代码片断....,不保证其正确性,仅作为一个记录....#include"stdafx.h"#include <vector>#include <string>#include <fstream>#include <windows.h>#include <boost/progress.hpp>#include <iostream>#include <algorithm>using namespace s 阅读全文

posted @ 2013-03-24 22:19 Orz.. 阅读(748) 评论(0) 推荐(0)

cl.exe 的include 及link路径命令行格式

摘要: 这两个vc中命令行的编译选项,仅作记录/LIBPATH:"f:\boost\stage\lib"/I "F:/boost" 阅读全文

posted @ 2013-03-24 17:25 Orz.. 阅读(732) 评论(0) 推荐(0)

boost test的测试环境

摘要: 试了一下boost 的测试框架,,发现还是可用的正常解开后,如果只是调用BOOST_AUTO_TEST_SUITE(test1)BOOST_AUTO_TEST_CASE(t_test2){ BOOST_CHECK_EQUAL(my_add(2,3), 5);}BOOST_AUTO_TEST_SUITE_END()这几部分好像还真的可以直接内嵌代码中去我把boost 的代码库的src 放进了f:\boost/*t1.cpp*/#define BOOST_TEST_MAIN #define BOOST_TEST_INCLUDED#include <boost/test/included/un 阅读全文

posted @ 2013-03-24 14:12 Orz.. 阅读(272) 评论(0) 推荐(0)

C++ 友元函数

摘要: #include <iostream>using namespace std;class Y;class X{ int _foo;public: X(int n):_foo(n){} void foobar(Y& y);};class Y{ friend class X; int _bar;public: Y(int n):_bar(n){}};void X::foobar(Y& y){ cout << y._bar << endl;} int main() { X x(3); Y y(4); x.foobar(y); return 0; } 阅读全文

posted @ 2013-03-24 08:56 Orz.. 阅读(140) 评论(0) 推荐(0)

导航