This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: STL list error
- To: "'Wilson'" <Wilson at WSSPL dot com>
- Subject: RE: STL list error
- From: "Rupert Wood" <me at rupey dot net>
- Date: Mon, 22 Oct 2001 10:37:02 +0100
- Cc: <help-gcc at gnu dot org>
Wilson wrote:
> 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.
C++ standard 23.2.2.4:
| 19. Effects: Eliminates all but the first element from every
| consecutive group of equal elements ...
i.e. unique() only considers uniqueness vs. adjacent elements. You need
to 'myList.sort();' first.
Rup.