473,395 Members | 1,488 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 1180

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: P G | last post by:
I hope this is on topic here. I have a problem compiling a simple example of the use of boost::bind. Please take a look at the program below. ...
4
by: Arturo Cuebas | last post by:
The program below contains a compile error. Following the program you will find the typical fix then my idea for a library that facilitates a more elegant fix. #include <boost\bind.hpp> using...
0
by: Russell Hind | last post by:
Is it possible to create a boost::bind object for a managed class method? With non-managed classes, I can do boost::function<void ()> f = boost::bind(&Class_c::Function, this); Is there a way...
2
by: IndyStef | last post by:
I am trying to use boost's bind on a member function, on the VC8 compiler. After using several different attempts, I could not get it to work. Does anybody know what is wrong with the code below?...
1
by: Olaf Petzold | last post by:
Hi, at this time I try to combine Qt and boost. Unfortunately I've run into trouble: void QWidget::insertAction ( QAction * before, QAction * action ); class QAction : public QWidget { ... };...
1
by: Tigera | last post by:
Greetings, I am trying to learn to use the Boost library, and I've run into a frustrating problem with the line marked here: #include <boost/function.hpp> #include <boost/functional.hpp>...
0
by: XHengDF | last post by:
I am a new gay to use the library boost, so i confused by some details! now, anybody could help me to explain the difference between boost::bind and boost::lambda::bind when i use the library. I...
3
by: =?iso-8859-1?B?Tm9yZGz2dw==?= | last post by:
Hey there, C++ Coders! I am learning multi-threading with boost and have come up with the following code example shown below. This example implements a test of the producer-consumer design...
1
by: kittymaguire | last post by:
I am using VC2005 and have refined new to be new (_NORMAL_BLOCK ,__FILE__, __LINE__) for the debug build so that the location of memory leaks are reported. The problem that I have is when, I...
3
by: Giovanni Gherdovich | last post by:
Hello, in the following code I have a pointer (to function), say p, of type double (*)(double, double, void*) and I try to fix the second argument of the function *p to a given value (using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.