Why does context.SetCurrent(&canvas); compile?

Luca Cappa luca.cappa at sequoia.it
Wed Jan 30 07:17:03 PST 2008


Hello,

On Wed, 30 Jan 2008 13:19:27 +0100, Carsten Fuchs  
<CarstenFuchs at T-Online.de> wrote:
>      context.SetCurrent(&canvas);    // Why does this line compile???
>
> Problem is that there is no overload of wxGLContext::SetCurrent() whose  
> signature matches a pointer to a canvas (the reference overload is OK of  
> course). Am I overlooking something?

just a guess, in the file include\wx\glcanvas.h I see:

#ifdef __WXUNIVERSAL__
     // resolve the conflict with wxWindowUniv::SetCurrent()
     virtual bool SetCurrent(bool doit) { return  
wxWindow::SetCurrent(doit); };
#endif

and if the symbol __WXUNIVERSAL__ is defined, then you are calling the  
SetCurrent(bool) method since the pointer could be converted to bool iirc  
(you could verify it easily running it in a debugger).

Luca




More information about the wx-users mailing list