On Monday 25 March 2002 10:43 am, you wrote:
Since my first post using the web interface seems to have been lost, I'm trying again via email...
Is it just me or is it my compiler (MSVC6SP5)? The following code gives me an error. Whats wrong?
#include
#include <functional> using boost::bind;
void main() { bind(std::greater<int>, _1, _2)(1, 2); }
main.cpp(8) : error C2275: 'std::greater<int>' : illegal use of this type as an expression
TIA, Markus
Two problems here:
- std::greater<int> is a type. You want std::greater<int>() to create an
object of that type
- constants can't (directly) be passed into boost::bind objects. You'll
need to have: int x = 1, int y = 2; and call the boost::bind object with (x,
y) instead of (1, 2).
If you still get errors, then it's your compiler's fault because it can't
figure out the return type. You'll have to tell bind to use an 'int' return
type, so the final code would look like this:
#include