This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
STL list error
- To: "'help-gcc at gnu dot org'" <help-gcc at gnu dot org>
- Subject: STL list error
- From: Wilson <Wilson at WSSPL dot com>
- Date: Mon, 22 Oct 2001 13:35:46 +0530
> Hi There,
> Check the following sample code. Here I expect the second unique() call to
> the list should make the list unique after the addition of 20 again. But
its
> not happening. Can you provide the reason for this.
>
> int main( void )
> {
> list< int > myList;
>
> myList.push_back( 10 );
> myList.push_back( 10 );
> myList.push_back( 20 );
> myList.push_back( 30 );
> myList.push_back( 40 );
>
> cout << "Size of list = " << myList.size() << endl;
> myList.unique();
> cout << "Size of list = " << myList.size() << endl;
> myList.push_back( 20 );
> myList.unique();
> cout << "Size of list = " << myList.size() << endl;
>
> }
>
> Regards
> Wilson
>
--
Orion Montoya, FSF Office Staff
Free Software Foundation | Phone: +1-617-542-5942
59 Temple Place, Suite 330 | Fax: +1-617-542-2652
Boston, MA 02111-1307 USA | Web: http://www.gnu.org