IT点滴

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

2011年6月2日

摘要: 我们先定义目标: 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 阅读(237) 评论(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 阅读(333) 评论(0) 推荐(0) 编辑