Connecting Tech Pros Worldwide Help | Site Map

rder of iteration over a map or a set

Hendrik Schober
Guest
 
Posts: n/a
#1: Jul 22 '05
Hi,

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

TIA,

Schobi

--
SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org

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


John Harrison
Guest
 
Posts: n/a
#2: Jul 22 '05

re: rder of iteration over a map or a set



"Hendrik Schober" <SpamTrap@gmx.de> wrote in message
news:c1fcbb$otj$1@news1.transmedia.de...[color=blue]
> Hi,
>
> if I iterate over a map or a set, is the order
> specified in which the elements are traversed?
>
> TIA,
>
> Schobi
>[/color]

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

john


Jeff Schwab
Guest
 
Posts: n/a
#3: Jul 22 '05

re: rder of iteration over a map or a set


Hendrik Schober wrote:
[color=blue]
> if I iterate over a map or a set, is the order
> specified in which the elements are traversed?[/color]

Yes.

Hendrik Schober
Guest
 
Posts: n/a
#4: Jul 22 '05

re: rder of iteration over a map or a set


Thanks Jeff and John!

Schobi

--
SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org

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


Chris Theis
Guest
 
Posts: n/a
#5: Jul 22 '05

re: rder of iteration over a map or a set



"John Harrison" <john_andronicus@hotmail.com> wrote in message
news:c1fd85$1i2e2q$1@ID-196037.news.uni-berlin.de...[color=blue]
>
> "Hendrik Schober" <SpamTrap@gmx.de> wrote in message
> news:c1fcbb$otj$1@news1.transmedia.de...[color=green]
> > Hi,
> >
> > if I iterate over a map or a set, is the order
> > specified in which the elements are traversed?
> >
> > TIA,
> >
> > Schobi
> >[/color]
>
> Yes, the order will be in ascending order of keys.
>[/color]

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



Hendrik Schober
Guest
 
Posts: n/a
#6: Jul 22 '05

re: rder of iteration over a map or a set


Chris Theis <Christian.Theis@nospam.cern.ch> wrote:[color=blue]
> [...]
> 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.[/color]

Thanks. I think I knew that. I was just
wondering whether implementations are
required to traverser their trees in
this order.
[color=blue]
> Chris[/color]

Schobi

--
SpamTrap@gmx.de is never read
I'm Schobi at suespammers dot org

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


Closed Thread