L
LuB
I'm writing a Win32 application - and more specifically, doing event
programming.
I want the application to be const compliant but I'm faced with a bit
of a conundrum.
Physically, many of my window methods can indeed be const Why? Many
Win32 calls send msg to a WNDPROC - or event handler. Therefore, a
const method may actually change something about a window. The 'value'
of const is lost here.
For example, to move a window - one can call ::SetPosition(hwnd, ...).
Assuming hwnd_ is a private instance member, If I wrap that call in a
class method, would I write
void SetPosition(...) const
{
::SetPosition(hwnd_, ...);
}
or
void SetPosition(...)
{
::SetPosition(hwnd_, ...);
}
Either would work. Logically, its not really a const method since its
changing a property of the window - namely, its position. But
physically, it can be labelled as const because of the inherent
indirection in event programming.
The answer must applicable/general enough to handle/work with _any_
message.
Just curious what the consensus is.
Thanks,
-Luther
programming.
I want the application to be const compliant but I'm faced with a bit
of a conundrum.
Physically, many of my window methods can indeed be const Why? Many
Win32 calls send msg to a WNDPROC - or event handler. Therefore, a
const method may actually change something about a window. The 'value'
of const is lost here.
For example, to move a window - one can call ::SetPosition(hwnd, ...).
Assuming hwnd_ is a private instance member, If I wrap that call in a
class method, would I write
void SetPosition(...) const
{
::SetPosition(hwnd_, ...);
}
or
void SetPosition(...)
{
::SetPosition(hwnd_, ...);
}
Either would work. Logically, its not really a const method since its
changing a property of the window - namely, its position. But
physically, it can be labelled as const because of the inherent
indirection in event programming.
The answer must applicable/general enough to handle/work with _any_
message.
Just curious what the consensus is.
Thanks,
-Luther