Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with STL and list container

Status
Not open for further replies.

biot023

Programmer
Nov 8, 2001
403
GB
Hallo.
I've only just started really using the STL, and so am very unfamiliar with its workings.
I have, in the protected section of a class declaration, the following code:
list<string> itm;
list::iterator<string> ptr;

This gives me the following error:
E2102 Cannot use template 'list<_Tp,_Alloc>' without specifying specialisation parameters

Things work out fine when I try 'list::iterator<string> ptr=itm.begin()', but I want an iterator that's permanently in scope within the class. I assume that I need to let the comiler know just what sort of iterator I want (list) in my declaration so that I can link it to the list in the constructor.
Does anyone know how to do this? & maybe know any links to idiot-proof FAQs or tutorials on the STL?

Any & all help gratefully appreciated.

Cheers,
Douglas JL

If it don't make you laugh, it ain't true.
 
Just realised - 'list::iterator<string> ptr=itm.begin()' doesn't work fine at all, even though all the help files show it being used thus.
I am well confused!

Douglas.

If it don't make you laugh, it ain't true.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top