
From: "Markus Schöpflin" <markus.schoepflin@ginit-technology.com>
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 <boost/bind.hpp> #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
To make it compile, you need to: * change std::greater<int> to std::greater<int>(); * change bind(... to bind<bool>(... since MSVC 6 cannot deduce the return type; * use the qualified boost::bind<bool> syntax to work around a bug in the compiler; and finally, use int x = 1; int y = 2; boost::bind<bool>(std::greater<int>(), _1, _2)(x, y); since bind cannot take rvalues (this is usually not a problem in real code, just in examples.)