473,385 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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.
Jul 23 '05 #1
10 1409

"sam" <sam++@--.com> wrote in message news:d5***********@news.hgc.com.hk...
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
Jul 23 '05 #2
sam wrote:
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
Jul 23 '05 #3
Hi Victor,
Appreciate if you could forward the direct link for that FAQ.

Thanks
Ganesh

Victor Bazarov wrote:
sam wrote:
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


Jul 23 '05 #4
Ganesh wrote:
Hi Victor,
Appreciate if you could forward the direct link for that FAQ.
http://www.parashift.com/c++-faq-lite/

And I'd appreciate it if you find time to read the archives and the
Welcome message posted here regularly where the location of the FAQ
and other useful information can be found. And I'd appreciate it if
you didn't top-post.

Thanks
Ganesh

Victor Bazarov wrote:
sam wrote:
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


Thanks
Victor

Jul 23 '05 #5
Victor Bazarov wrote:
This is covered in the FAQ 5.8.


FYI, these numbers change from time to time.

Jul 23 '05 #6
Abecedarian wrote:
Victor Bazarov wrote:
This is covered in the FAQ 5.8.

FYI, these numbers change from time to time.


That particular one hasn't changed in a while.
Jul 23 '05 #7
Victor Bazarov wrote:
Abecedarian wrote:
Victor Bazarov wrote:
This is covered in the FAQ 5.8.

FYI, these numbers change from time to time.


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::

Jul 23 '05 #8
Abecedarian wrote:
Victor Bazarov wrote:
Abecedarian wrote:
Victor Bazarov wrote:
This is covered in the FAQ 5.8.
FYI, these numbers change from time to time.


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.


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
Jul 23 '05 #9
Victor Bazarov wrote:
And I'd appreciate it if you find time to read the archives
and later
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?


Jul 23 '05 #10
Abecedarian wrote:
Victor Bazarov wrote:
And I'd appreciate it if you find time to read the archives

and later

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?


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.
Jul 23 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Andrea | last post by:
Hi, I'm trying to emulate part of our client-server application as a web site so customers can use it, and I'm stuck when it comes to re-ordering items in a list. Basically we have a list of...
39
by: Nicolas Fleury | last post by:
In the following example: class MyMetaclass(type): pass class MyBaseType(object): __metaclass__ = MyMetaclass class MyType(MyBaseType): x = 4 y = 5 z = 6 Is there any way to modify...
7
by: Marcio Rosa da Silva | last post by:
Hi! In dictionaries, unlinke lists, it doesn't matter the order one inserts the contents, elements are stored using its own rules. Ex: >>> d = {3: 4, 1: 2} >>> d {1: 2, 3: 4}
0
by: Hunters | last post by:
Once you reorder the listview items, largeicon or smallicon view will not follow the order of list or detail view which is the correct order. For example with a listview as...
7
by: Lasse Vågsæther Karlsen | last post by:
I have a list of items and a "rule" for ordering them. Unfortunately, the rule is not complete so it won't define the correct order for any two items in that list. In other words, if I pick...
8
by: Bill | last post by:
I'm trying to create a wizardlike interface using a couple listboxes. I know you've seen it before. You double click on an item in one listbox and it "moves" it to the other. I used to approach...
6
by: segue | last post by:
Hi; I need to change the order of a listbox array from a form app where I select order up or down. What's a good way to do that? Regards; Segue
10
by: pamelafluente | last post by:
Hi I have a sorted list with several thousands items. In my case, but this is not important, objects are stored only in Keys, Values are all Nothing. Several of the stored objects (might be a...
2
by: pavanip | last post by:
Hi, I have a problem with binding data to dropdownlist from database in alphabetical order. My database contains some fields like All,Air,Airline,Books,Cars etc. There are 2 dropdown...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.