max() of two vectors

I thought max() function is to get the maximum between two values. But today I saw it can take in two vectors as below:

1
2
vector<int> a,b,c;
c=max(a,b);


So what would be in c?

L
Why don't you try it ?
I tried, but not sure whether my understanding is correct based on the result.

a={1,2,3,4};
b={1,2,3,1};
max(a,b) will be {1,2,3,4};

a={1,4,3,1};
b={1,2,3,1};
max(a,b) will be {1,4,3,1};

a={1,2,3,1};
b={1,2,4,1};
max(a,b) will be {1,2,4,1};

It seems the max() return the vector who is the first has the larger element by comparing from left hand side.

Am I correct?

L
yes, it's a lexicographical compare, just like in a dictionary
Topic archived. No new replies allowed.