Actually I meant that you have a table with an entry for every action that a key can be bound to and then the keycode for the key that is bound to that action. Then you can just poll the corresponding entry if/when needed.
Key binding itself is then as simple as:
Wait for any input
Update the slot in the lookup table
And tada, your keybinding has O(1) lookup time.
Something like this (pseudo-pseudo code):
enum Action
{
WalkForward,
Jump,
__Max
}
KeyCodeType LookupTable[Action::__Max] = { 0 };
void BindKeyToAction(Action action)
{
KeyCodeType input = GetNextKeyPress();
LookupTable[action] = input;
}
void GameLoop()
{
while(1)
{
if(HasInput(LookupTable[Action::Jump])
Jump();
}
}