[Solved] Creating and pushing back a vector of functions


You shouldn’t be using typedef here. That means you are aliasing those types to the names you specify, not creating instances of them.

You should do this instead:

//create a vector of functions which take no arguments and return an int
std::vector<std::function<int()>> functionvector {};
//implicitly converts the function pointer to a std::function<int()> and pushes
functionvector.push_back(function1);

5

solved Creating and pushing back a vector of functions