I have the following types declared inside a class:
using ScriptFunction = std::function<void(std::string const&)>;
using Script_map = std::unordered_map<std::string, std::vector<ScriptFunction>>;
In this class i wish to store some member functions from other classes and call it like this:
void Manager::callback(std::string event, std::string data) {
auto it = this->stored_func.find(event); //stored_func is a Script_map
for (auto func : it->second) {
func(data);
}
}
The code works but, i want to change it so i can callback functions that receives 1 or 2 strings, or no argument at all. Is this possible?