Moving character in given direction C++ SFML
FunctionPointerWrapper_t seems unnecessary; we can store a std::function&lt;void()&gt; in the map directly. To create this function, we can either use std::bind:

auto player = std::make_shared&lt;Player&gt;(*this);
inputControl.addKeyToCheck( sf::Keyboard::H, std::bind(&amp;Player::sayHello, player) );


or a lambda function:

auto player = std::make_shared&lt;Player&gt;(*this);
inputControl.addKeyToCheck( sf::Keyboard::H, [=] () { player-&gt;sayHello(); } );


Note that both of these examples internally create a copy of the shared_ptr.



For cutting down on the number of named functions in the player class, we can route the functionality to a single move function, something like:

void Player::move(Vector2f const&amp; speed) { getComponent&lt;Velocity&gt;() += speed * mv::constants::mob::DEFAULT_SPEED; }


We can then use std::bind, or lambda functions as above:

inputControl.addKeyToCheck( sf::Keyboard::W, std::bind(&amp;Player::move, player, Vector2f(0.f, -1.f)) );
inputControl.addKeyToCheck( sf::Keyboard::W, [=] () { player-&gt;move(Vector2f(0.f, -1.f)); });


Where Vector2f(0.f, -1.f) can be replaced by whatever the actual desired type / value is. (We could also do the multiplication outside of the move function, if it's not common between the functions).

We still need to define 4 functions, but there's less overhead in the Player class.

To simplify it further, we'd probably want to define some sort of axis mapping, so we could do something like:

inputControl.addAxis(Axis(sf::Keyboard::W, sf::Keyboard::S, maxSpeed, minSpeed), [=] (float axisValue) { player-&gt;moveVertically(axisValue); });


(and perhaps even allow a 2d-axis to be defined mapping 4 keys to one function call) but that might be a fair amount of extra work.



General comments:


InputManager::addKeyToCheck and InputManager::eraseKey should probably not return a fixed true / false without checking if they actually succeeded.