468,497 Members | 1,847 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,497 developers. It's quick & easy.

Interesting Boost::bind error?

joe
I expected I could construct code like the following:

return *(std::min_element(vec.begin(), vec.end(),
bind(less<double>(),
bind(&entry::foo, _1),
bind(&entry::foo, _2))));

But if vec is only size 1, this returns '0'. min_element should work
on size one vectors.
If I add the guard "if(vec.size() == 1) { return *(vec.begin()); } "

all works fine..

Looking at the implementation code for min_element, this predicate
shouldn't even be called. Any ideas? Is boost messing with this
somehow?
Mar 10 '08 #1
0 1018

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by P G | last post: by
4 posts views Thread by Arturo Cuebas | last post: by
reply views Thread by Russell Hind | last post: by
2 posts views Thread by IndyStef | last post: by
1 post views Thread by Olaf Petzold | last post: by
1 post views Thread by Tigera | last post: by
reply views Thread by XHengDF | last post: by
3 posts views Thread by =?iso-8859-1?B?Tm9yZGz2dw==?= | last post: by
1 post views Thread by kittymaguire | last post: by
3 posts views Thread by Giovanni Gherdovich | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.