IT点滴

我不去想是否能够成功 既然选择了远方 便只顾风雨兼程
  博客园  :: 首页  :: 联系 :: 订阅 订阅  :: 管理

随笔分类 -  Boost

摘要:我们先定义目标: 1. simple_bind 提供与 bind 类似的界面,可以只考虑通过对象引用(或者值)调用成员函数的情况,而不考虑 free function 或者通过指针调用等等。具体地说,就是允许 person.SetName("Ralph") --> simple_bind(&Person::SetName, person, _1)(string("Ralph")) simple_bind(&Person::SetName, _1, string(“Ralph"))(person) simple_bind(& 阅读全文

posted @ 2011-06-02 11:39 Ady Lee 阅读(244) 评论(0) 推荐(0)

摘要:Boost.bind 好用么?当然好用,而且它也确定进入下一代的 C++ 标准了,也早就进了 TR1 了。回顾一下,它允许我们干这个:#include <algorithm>#include <iostream>#include <string>#include <vector>#include <boost/bind.hpp>using namespace std;using namespace boost;struct Person{ Person(const string& name) : name_(name) {} 阅读全文

posted @ 2011-06-02 10:54 Ady Lee 阅读(340) 评论(0) 推荐(0)

摘要:bind - boost 头文件: boost/bind.hpp bind 是一组重载的函数模板.用来向一个函数(或函数对象)绑定某些参数. bind的返回值是一个函数对象. 它的源文件太长了. 看不下去. 这里只记下它的用法: 9.1 对于普通函数 假如有函数 fun() 如下: void fun(int x, int y) {cout << x << ", " << y << endl;}现在我们看看怎么用bind 向其绑定参数. 对于像 fun 这样的普通函数. 若fun 有n个参数. 则 bind 需要 n+1 个参数 阅读全文

posted @ 2011-06-01 16:35 Ady Lee 阅读(363) 评论(0) 推荐(2)

摘要:环境: VS2010,boost_1_46_1,解压缩后放在,D:\boost_1_46_1。1,编译。boost库大部分源文件是只有投文件,所以有很多库不用编译就可以使用。但是有些库是需要编译源码的。asio就需要编译。怎么去编译呢?在boost官方网站下载bjam.exe,放入boost源文件的根目录下面。因为asio依赖于其它的一些库,所以编译参数还有点复杂。然后在cmd下输入D:\boost_1_46_1>bjam --with-system --with-thread --with-date_time --with-regex --with-serialization stag 阅读全文

posted @ 2011-05-31 15:26 Ady Lee 阅读(896) 评论(0) 推荐(0)

摘要:网上有很多安装方法,以下是我成功安装的步骤1.下载boost_1_34_1压缩文件,解压缩到d:\boost_1_34_1\目录下2.编译bjam从vs2005的工具菜单进入命令提示窗口(一定要从这进),cd到d:\boost_1_34_1\tools\jam\src下执行build.bat,会在d:\boost_1_34_1\tools\jam\src\bin.ntx86\產生bjam.exe,將bjam.exe複製到d:\boost_1_34_1\下。3.设定编译环境修改user-config.jam (d:\boost_1_34_1\tools\build\v2\user-config. 阅读全文

posted @ 2009-07-28 12:19 Ady Lee 阅读(1919) 评论(0) 推荐(0)