Well you'd have to make updateSomething a static function otherwise you'd have to send a Controller object to button.
Are you trying to use this as a callback for when the button is pressed ? It might be better not to template this and simply provide a specific function type to be called:
1 2 3 4 5
Button<void (*)(int)> button; // what now... what gets sent to int.
// ...
void Button<T>::onClick() { m_func(); } // err
class Button
{
public:
using Function = std::function<void()>;
Button(Function callback) : m_callback(callback) { }
private:
Function m_callback;
void onClick() { m_callback(); } // since this will always have to be void() anyways
};
class Controller
{
public:
Controller() : button(std::bind(&Controller::updateSomething, this)) { }
private:
Button button;
void updateSomething() { }
};