【发布时间】:2011-06-13 17:34:41
【问题描述】:
我想将bind1st(mem_fun(&my_class::f), this) 函子传递给for_each。不幸的是,它很难阅读,所以我想给它起一个更易读的名字:
(the type I am looking for) meaningful_name = bind1st(mem_fun(&my_class::f), this);
for_each(v.begin(), v.end(), meaningful_name);
有没有一种简单的方法来推断函子的类型? (我知道mem_fun 正是因为这个原因为我们节省了很多痛苦。)
【问题讨论】:
标签: c++ templates stl functional-programming functor