This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
mem_fun family (for_each, bind..)
- To: gcc@gcc.gnu.org, gcc-bugs@gcc.gnu.org
- Subject: mem_fun family (for_each, bind..)
- From: Levente Farkas <!spam-lfarkas@mindmaker.hu>
- Date: Fri, 06 Aug 1999 13:50:16 +0200
- Newsgroups: comp.lang.c++.moderated,comp.lang.c++
- Organization: Mindmaker Ltd.
- Reply-To: lfarkas@mindmaker.hu
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