我想通過bind1st(mem_fun(&my_class::f), this)
仿函數到for_each
。不幸的是它是非常難讀,所以我想給它一個更readible名字是這樣的:自動推斷bind1st的類型(mem_fun(&my_class :: f),this)?
(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
爲我們節省了很多痛苦。)
差不多:它應該是`mem_fun1_t`,不`mem_fun1_1`。 – 2011-01-22 16:50:48