Original Post
I've been studying the Window Class code on gamedev.net. So far I've hit many problems, most of which I've been about to fix with a few tweaks that I'm not sure even work, beyond removing the errors I keep getting. Now I've hit a problem that I can't tweak my way out of. Here's the relevent code: And here's the error I'm getting: c:\Other People's Projects\GameDev.net\Window Class\Window.cpp(12) : error C2451: conditional expression of type 'std::_Tree<_Traits>::iterator' is illegal with [ _Traits=std::_Tmap_traits,std::allocator>,false> ] No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called I'm not sure what I need to do to fix this problem. Does anyone have any idea what I can do? Better yet, does anyone have a working source for this project that I can study? Thanks.
Window::tyMessageIterator Window::GetMessageHandler(long message)
{
Window::tyMessageIterator it = m_MsgHandlers.find(message);
if(it = m_MsgHandlers.end())
return NULL;
return it;
}
class Window
{
public:
//I'm not sure where the following 3 lines were supposed to
// go, but this is the only place that didn't produce an
// error.
typedef long (* tyMessageHandler)(Window &, HWND, long, long);
typedef std::map<long, tyMessageHandler> tyMessageMap;
typedef tyMessageMap::iterator tyMessageIterator;
tyMessageMap m_MsgHandlers;
LRESULT CALLBACK MsgRouter(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam);
tyMessageIterator Window::GetMessageHandler(long message);
};