This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

mem_fun family (for_each, bind..)


hi,
it's another strange program :
-----------
#include <vector>
#include <functional>
#include <algorithm>

class A
{
  typedef std::vector<A *> vec;
  vec v;
public:
  void f(double& d) const { ++d; }
  void g()
  {
    double d = 1;
    std::for_each(v.begin(), v.end(), 
                  std::bind2nd(std::mem_fun(&A::f), d));
  }
};

int main()
{
  A a;
  a.g();
  return 0;
}
-----------
I'm just wondering "is there anybody who realy try to use standard c++ ?".
since I run into problems like this day after day. I'm not talking about 
that microsoft standard implemetation sucks all the day (like in the above
ms forget to implement const member function (it can be corrected in
ms's header file), but can't corrent template specialization for void since
ms's compiler don't support it), but this simple example can't compile even
on the latest egcs/gcc - 2.95!
or am I wrong ?

 -- Levente

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]