thrower thrower - 1 year ago 72
C++ Question

What does option -s in operator = map, in c++?

I recently take a look at my old code and i can't figure out what this option, if it's really an option, do.
the code is something like:

map<string, string> map;
map[string1] = ("s", string2);

Answer Source

Comma is operator, that evaluates arguments from left to right, and has value of most-right element.

For example:

int a=2, b=3, c;
c = (a+=b, a*b); 

So, from left, a+=b is evaulated first, which sets a to 2+3, then a*b is evaulated, and expression has value of 5*3, which value is used. So c is 15

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download