I got the following compile errors when I used STL
list::insert ( iterator position, size_type n, const T& x );
==================
Expand|Select|Wrap|Line Numbers
- #include <iostream>
- #include <list>
- main()
- {
- list<int> myList;
- list<int>::iterator it;
- myList.push_back(0);
- it = myList.begin();
- myList.insert(it, 2); // 2 0
- myList.insert(it,2,20); // <--- Compile errors
- }
%g++ simpleList.cc
*************************
/software/gnu/gcc/2.8.1/sun4os5.10/include/g++/stl_list.h: In method `void list<int,__default_alloc_template<false,0> >::insert(struct __list_iterator<int,int &,int *>, int, int)':
/software/gnu/gcc/2.8.1/sun4os5.10/include/g++/stl_list.h:387: invalid type argument of `unary *'
*************************
Why does this fail to compile? Any help would be appreciated.
thanks,
PL