Boost logo

Boost Users :

From: Mark Ruzon (mark34_at_[hidden])
Date: 2007-09-28 20:12:24


Suppose you want to compute 3 - x for a vector of floats:

  using namespace std;
  vector<float> v;
  transform(v.begin(), v.end(), v.begin(), boost::bind(minus<float>(), _1, 3.0f));

This compiles fine on the MSVC 8.0 compiler. But I want to compute x - 3, and
replacing _1 with _2 in the above expression yields a mess of errors, starting
with:

c:\program files\boost\boost_1_34_1\boost\bind.hpp(278) : error C2679: binary
'[' : no operator found which takes a right-hand operand of type
'overloaded-function' (or there is no acceptable conversion)
        c:\program files\boost\boost_1_34_1\boost\bind.hpp(205): could be
'float boost::_bi::list1<A1>::operator [](boost::arg<I>) const'
        with
        [
            A1=float &,
            I=1
        ]

Anybody have any thoughts on this one?

Thanks,
Mark


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