Boost logo

Boost Users :

From: markus_schoepflin (markus.schoepflin_at_[hidden])
Date: 2002-03-25 11:42:53


--- In Boost-Users_at_y..., "Peter Dimov" <pdimov_at_m...> wrote:
>
> 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;
>

Thanks a lot, Peter!
 
> 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.)

Hmm, the following code compiles and executes ok for me.

#include <boost/bind.hpp>
#include <functional>
#include <iostream>

using boost::bind;

void main()
{
  std::cout
    << boost::bind<bool>(std::greater<int>(), _1, _2)(2, 1)
    << '\n';
}

Markus


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net