S
Simon Elliott
In a class function body, I'm trying to pass 'this' to another function.
I'm getting an error because 'this' seems to have become const. Any
ideas as to why this has happened?
extern void DoSomethingWithFoo(foo* fooPtr);
virtual void foo::doStuff(void)
{
DoSomethingWithFoo(this); // error: can't convert foo* const to foo*
}
Very weirdly, in another very similar class, exactly the same idiom has
worked. The only difference is that the function is inlined into the
header in the case which doesn't work. Is there some rule that says that
'this' is const when inlined into the header?
I'm getting an error because 'this' seems to have become const. Any
ideas as to why this has happened?
extern void DoSomethingWithFoo(foo* fooPtr);
virtual void foo::doStuff(void)
{
DoSomethingWithFoo(this); // error: can't convert foo* const to foo*
}
Very weirdly, in another very similar class, exactly the same idiom has
worked. The only difference is that the function is inlined into the
header in the case which doesn't work. Is there some rule that says that
'this' is const when inlined into the header?