typedef void (*size_fn)(int, int);
typedef void (*key_fn)(InputType, int);
typedef void (*pointer_fn)(InputType, int, int);
typedef std::hash_map<const void*, size_fn> size_handle_c;
typedef std::hash_map<const void*, key_fn> key_handle_c;
typedef std::hash_map<const void*, pointer_fn> pointer_handle_c;
size_handle_c size_handles;
key_handle_c key_handles;
pointer_handle_c pointer_handles;
And am trying to initialize them in the constructor as follows:
EventManager* EventManager::instance = NULL;
EventManager::EventManager()
: size_handles(), key_handles(), pointer_handles()
{
instance = this;
}
Problem is, when I go to handle an event:
void EventManager::FirePointer(InputType type, int x, int y) const
{
if(pointer_handles.size() == 0) return;
pointer_handle_c::const_iterator i = pointer_handles.cbegin(); //Access violation
pointer_handle_c::const_iterator e = pointer_handles.cend();
while(i != e) i++->second(type, x, y);
}
I get an access violation at the indicated line. It looks like all my hash_maps are also basically uninitialized. Did I completely miss something in construction?