Problem with boost::bind and member function returning auto_ptr?

It seems, that, despite the documentation claiming they are equivalent, the following alternative works: boost::bind (boost::mem_fn (&X::memfunc), this) Go figure.

It seems, that, despite the documentation claiming they are equivalent, the following alternative works: boost::bind (boost::mem_fn (&X::memfunc), this); Go figure...

It's not valid to say "void f() const". That is, introducing a const for a function type without using typedef and when it's not for a member-pointer type (like "void(M::*)() const") is invalid. You have to say "typedef void f() const"; then you can use "f" as a function-type const-qualified.

Maybe boost does otherwise somewhere in its code. – Johannes Schaub - litb May 12 '09 at 10:05 On the other side, the warning could also mean that the const here: template void f(T const&); is ignored (there are no literally "const qualified" function-types). That ignorance is formally only contained in the c++1x working paper, and not yet in c++98 and not (to my knowledge) in c++03.In those standards where it's not yet contained, such a try to create a const-qualified function typoe (as in "const T" - not as in the one contained in my previous comment) is ill-formed (results in a warning or error).

– Johannes Schaub - litb May 12 '09 at 10:09 yes, it's the second kind of issue: the line in question does this: typedef M const & type; with M being a function type. Thus trying to literally const-qualifying a function-type, yielding to the correct warning. – Johannes Schaub - litb May 12 '09 at 10:12 Sure,i looked at the code, but that doesn't explain why it works if the return type is an int instead of an auto_ptr?

– jon h. May 12 '09 at 10:34 Or why the alternative formulation using boost::mem_fn (which is supposed to be the same) works. – jon h.

May 12 '09 at 10:36.

Bind(&X::memfunc, this); bind >(&X::memfunc, this).

It gives the same error. – jon h. May 12 '09 at 8:49 This works though: boost::bind (boost::mem_fn (&X::memfunc), this); – jon h.

May 12 '09 at 8:52.

FYI: gcc 4.3.3 compiles the code fine. Terms of service.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions