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]

Re: mem_fun family (for_each, bind..)



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

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