If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

// The templated ctor allows copy construction from any object that's
// castable. Thus, it does downcasts:
// base_ref = derived_ref
template <class T_CppObject>
template <class T_CastFrom>
inline
RefPtr<T_CppObject>::RefPtr(const RefPtr<T_CastFrom>& src)
:
// A different RefPtr<> will not allow us access to pCppObject_. We need
// to add a get_underlying() for this, but that would encourage incorrect
// use, so we use the less well-known operator->() accessor:
pCppObject_ (src.operator->())
{
if(pCppObject_)
pCppObject_->reference();
}

I don't actually want to change anything in the member variable canvas_event_box. I just want to be able to call one of its functions from my 'const' member function. Is there any syntax I can use to tell VC++ that I'm not actually changing the variable - just using it

Re: 'const' member functions

Which line is line 199?

I don't actually want to change anything in the member variable canvas_event_box

Don't use functions that imply that you do want to change the value. If a function is non-const, and you decide to use that function on a non-mutable variable, then nothing is going to fix that except to redesign your code.

Re: 'const' member functions

You can create a duplication function, stick the const keyword at the end of it, call it in your main function, and compile.

If the compiler doesn't like it, you'll know what in there can be potentially dangerous.

Thanks. I tried that a little earlier and it compiled OK. However, it would give me a non-standard API - which isn't a massive problem and I'd probably do it that way if there was any danger but for the moment, I think I'd prefer to stick with the const_cast fix. Thanks for all your help Paul.

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.