I'm planning on using function pointers to implement different functions in a class. However, I've run into a bit of trouble while trying to implement one such function.
The code is here:
std::vector<int> * (*create_vector)()
{
std::vector<int> * vec_p = new std::vector<int>;
return vec_p;
}
The errors are as follows:
3: [Error] expected primary-expression before '*' token
3: [Error] 'vec_p' was not declared in this scope
3: [Error] expected '}' before ';' token
4: [Error] expected unqualified-id before 'return'
5: [Error] expected declaration before '}' token
Is there something I'm misunderstanding about function pointers, or is it a different issue?