Reputation: 141
I'm new at C++ programming and I'm having troubles trying to define a pointer to a list. This is the code I'm trying to use:
list<int>* pl;
The error:
/home/julian/Proyectos Code::Blocks/pruebas/main.cpp|17|error: expected type-specifier before ‘list’|
Is it posible to define a pointer to a list? I need to have a function that returns a pointer to a list.
Thank you very much
Upvotes: 9
Views: 13245
Reputation: 182619
You have to include the list
header and qualify the name list
:
#include <list>
std::list<int> *p;
Alternatively:
using std::list;
list<int> *p;
Upvotes: 12