Page 3 of 3

Re:Help with Cryptic C++ code

Posted: Thu Feb 23, 2006 1:59 am
by Solar
BI approximates his mood using a Lagrange algorithm. Sometimes he's a jolly chap to have around, sometimes he's a bit testy. ;D

Re:Help with Cryptic C++ code

Posted: Thu Feb 23, 2006 2:30 am
by distantvoices
@solar: yeah, that's a taylor series with a lagrange remainder member (in german it's the lagrang'sches Restglied)*gg*

@Neo: Slow down, breathe and relax: I have been talking to solar about an event, then you ask anyone but me what the heck I'm talking about and then you wonder why I'm a bit testy about that? Oh, come on, lad.
Err.. ??
That was to beyond_infinity's post.
That#s what it is about, fyi ;-)

Now, I suppose we'll have a coffee and give it a rest, ok?

Re:Help with Cryptic C++ code

Posted: Thu Feb 23, 2006 3:49 am
by Neo
beyond infinity wrote: @Neo: Slow down, breathe and relax:
Think you need to do that bro.
I have been talking to solar about an event, then you ask anyone but me what the heck I'm talking about and then you wonder why I'm a bit testy about that? Oh, come on, lad.
The first post from you in this thread (which is about C++ multimaps BTW) is the one where you where talk about breakpoint 2006, which confused me. Hence the "Err..??"
And then you ask me if I have a problem with what you are posting? Funny.
Now, I suppose we'll have a coffee and give it a rest, ok?
Sure.

Re:Help with Cryptic C++ code

Posted: Tue Feb 28, 2006 8:10 am
by Neo
Solar wrote: When constructing a multimap, you can pass to the constructor a function object (predicate) that does the ordering. By default, this is [tt]less[/tt], meaning that, if you get two elements X, Y with X->first == Y->first, you will get one after another, but the exact order is unspecified (as neither is "less" than the other). This is called "strict weak ordering".
Just wanted to confirm this. If I have a [font=Courier New]multimap<priority, Struct1>[/font]
and I insert items like
[font=Courier New]<1,struct_var1>
<0,struct_var2>
<1,struct_var3>
<2,struct_var4>
<0,struct_var5>[/font]
and when I traverse through this multimap will I get the elements in this order
struct_var2
struct_var5
struct_var1
struct_var3
struct_var4
I did get this with gcc (is it the same with the others?)

Re:Help with Cryptic C++ code

Posted: Wed Mar 01, 2006 1:01 am
by Solar
Neo wrote: ...when I traverse through this multimap will I get the elements in this order...
No.

You will get struct_var2 and struct_var5 before you get the others, and you will get struct_var4 last. But whether you get struct_var2 before or after struct_var5 is not defined, and neither is whether you get struct_var1 before or after struct_var3.

Actually, the sequence could be different the very next time you iterate through the map. Edit: Not really sure here, but better safe than sorry.

It is very dangerous to go "trial and error" in these things. The next version of GCC might change this behaviour, and silently (i.e., without mentioning the fact anywhere), because the standard does not guarantee a strong ordering here.

Re:Help with Cryptic C++ code

Posted: Wed Mar 01, 2006 8:21 am
by Neo
Hmmm........ ok. Should keep that in mind then.
@Solar: Thanks.

Re:Help with Cryptic C++ code

Posted: Tue Mar 07, 2006 5:49 am
by Candy
Neo wrote: Hmmm........ ok. Should keep that in mind then.
@Solar: Thanks.
The order probably is stable but unpredictable up-front. The multimap probably uses a set for each key, with a tree or a hash implementation behind it.