The order of items stored in STL List is not preserved.

S

sam

Hi,

How could this happened? I did not insert or delete any items in the
list, but when I print it out from the list, the order of the items are
randomly rearranged by STL list.

Sam.
 
V

Victor Bazarov

sam said:
How could this happened? I did not insert or delete any items in the
list, but when I print it out from the list, the order of the items are
randomly rearranged by STL list.

This is covered in the FAQ 5.8.

V
 
H

Howard

sam said:
Hi,

How could this happened? I did not insert or delete any items in the list,
but when I print it out from the list, the order of the items are randomly
rearranged by STL list.

Sam.

Well, I assume you must have inserted at some point, or it would be empty!
:)

Anyway, std::list never shuffles its contents, so there must be an error in
your code, either when inserting or when traversing. Post the code you used
for filling it and for reporting its contents, and maybe we can spot the
error.

-Howard
 
G

Ganesh

Hi Victor,
Appreciate if you could forward the direct link for that FAQ.

Thanks
Ganesh
 
A

Abecedarian

Victor said:
That particular one hasn't changed in a while.

What I mean is that neither the number nor the direct URL to the
question is reliable.

::A::
 
V

Victor Bazarov

Abecedarian said:
What I mean is that neither the number nor the direct URL to the
question is reliable.

What I mean is that at the time when I post this both are fine.
Do you actually have a point or do you just have too much time on
your hands?

V
 
V

Victor Bazarov

Abecedarian said:
and later

Again, do you have a point? Please, if you do, deliver it. Using
two quotes from two different posts of mine without explaining what
you want to say by that is *meaningless*. I am not going to play
a guessing game with you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top