
23 Jun
2007
23 Jun
'07
5:47 p.m.
Vincent Poinot wrote:
shunsuke wrote:
Vincent Poinot wrote:
As you can see, the available comparison function objects operates on objects X, the deref() helper function creates a new function object that will call the original less<>() after dereferencing its arguments, allowing sort() to work as expected. It seems boost::indirect_fun? http://www.boost.org/libs/ptr_container/doc/indirect_fun.html
You are right, I was not aware of this... However, a remark: the example I gave in my first post using accumulate() does not work with make_indirect_fun():
X sum = accumulate(v.begin(), v.end(), X(), deref<X*>(plus<X>())) ;
How about boost::indirect_iterator? -- Shunsuke Sogame