mem_fun family (for_each, bind..)

Gary Granger granger@atd.ucar.edu
Fri Aug 6 13:00:00 GMT 1999


The draft standard I have lists the bind2nd declaration as follows:

    template <class Operation, class T>
      binder2nd<Operation> bind2nd(const Operation&, const T&);

It looks like the type 'double' you are passing cannot be used since it is
not constant.  I replaced your reference with a pointer and it compiled and
ran with no problems:

Across the ether fly the words of Levente Farkas:
...
>   void f(double& d) const { ++d; }
void f(double *d) const { ++(*d); }
...
>                   std::bind2nd(std::mem_fun(&A::f), d));
                    std::bind2nd(std::mem_fun(&A::f), &d));

> ...
> 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 ?

If you are not sure whether this "simple example" complies with the
standard, then perhaps it is not so simple, and you should instead let the
newsgroups answer the STL question *before* asking the bug question.

gary


More information about the Gcc mailing list