rder of iteration over a map or a set

H

Hendrik Schober

Hi,

if I iterate over a map or a set, is the order
specified in which the elements are traversed?

TIA,

Schobi

--
(e-mail address removed) is never read
I'm Schobi at suespammers dot org

"Sometimes compilers are so much more reasonable than people."
Scott Meyers
 
J

John Harrison

Hendrik Schober said:
Hi,

if I iterate over a map or a set, is the order
specified in which the elements are traversed?

TIA,

Schobi

Yes, the order will be in ascending order of keys.

john
 
C

Chris Theis

John Harrison said:
Yes, the order will be in ascending order of keys.

An additional comment to the OP: What "ascending" means in this context
depends on the sorting criterion, for which a default value (less) is
supplied.

Chris
 
H

Hendrik Schober

Thanks Jeff and John!

Schobi

--
(e-mail address removed) is never read
I'm Schobi at suespammers dot org

"Sometimes compilers are so much more reasonable than people."
Scott Meyers
 
H

Hendrik Schober

Chris Theis said:
[...]
An additional comment to the OP: What "ascending" means in this context
depends on the sorting criterion, for which a default value (less) is
supplied.

Thanks. I think I knew that. I was just
wondering whether implementations are
required to traverser their trees in
this order.

Schobi

--
(e-mail address removed) is never read
I'm Schobi at suespammers dot org

"Sometimes compilers are so much more reasonable than people."
Scott Meyers
 

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,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top