Re: mem_fun vs mem_fun_ref

From: Ioannis Vranos (ivr_at_remove.this.grad.com)
Date: 03/17/05


Date: Thu, 17 Mar 2005 18:28:43 +0200

However this compiles:

> #include <vector>
> #include <algorithm>
> #include <functional>
>
>
> class B {};
> class C {};
>
> class A
> {
> public:

     virtual C foo(const B) const { return C(); }

> };
>
>
>
> int main()
> {
> using namespace std;
>
> A obj;
> A &a = obj;
>
> vector<B> in(42);
>
> vector<C> out(in.size());
>
> transform(in.begin(), in.end(), out.begin(),
> bind1st(mem_fun_ref(&A::foo), obj) );
> }

Isn't there any way to maintain the reference argument in foo?

-- 
Ioannis Vranos
http://www23.brinkster.com/noicys


Relevant Pages

  • Re: Errors in compilation of simple programme
    ... using namespace std; ... cin>> i; ... it compiles without a problem on Visual C++ ... int main ...
    (microsoft.public.vc.language)
  • Re: Errors in compilation of simple programme
    ... using namespace std; ... cin>> i; ... it compiles without a problem on Visual C++ ... int main ...
    (microsoft.public.vc.language)
  • Re: problem with rand()
    ... > Using gcc, this compiles, runs, and outputs as expected, but on ... > using namespace std; ... > int main ...
    (comp.lang.cpp)
  • getline
    ... using namespace std; ... int main ... it compiles but when run it doesn't wait for me to enter a sentence at the ... Type a word: lol ...
    (comp.lang.cpp)
  • renee.c
    ... typedef struct AttrString *AttrString; ... Tcl_Obj *Obj; ... int red, green, blue, index; Colour next; ... chars name; ...
    (comp.lang.tcl)