about list

how can i declare a object of list. a object of my own. and be able to insert and remove at any position by using an index. I tried to add to the list using an index but it doesnt work. no matter what i try. i played around with the list sample and iterator and still couldnt get it working. is it not possible to do something like

1
2
3
4
list<myobject>mylist;

mylist.insert(3,myobject);// attempt to add object at index 3. doesnt work.


i dont want to really use vector because i need to insert and move in different places and positions.

The first parameter needs to be a list<myobject>::iterator, not an index. And that position is invalid anyway as the list has a size of 0 initially.
Topic archived. No new replies allowed.