Mooophy / Cpp-Primer

C++ Primer 5 answers
Creative Commons Zero v1.0 Universal
8.07k stars 2.99k forks source link

Fix Exercise 14.3(c) #791

Closed harshitpant1 closed 3 years ago

harshitpant1 commented 3 years ago

As svec1 and svec2 are vectors of strings, svec1 == svec2 will use == operator defined for vectors, as well as, that defined for strings(as every member in svec1 will be compared for equality with corresponding member in svec2 using ==defined for strings).

Reference - https://en.cppreference.com/w/cpp/container/vector/operator_cmp

From above link -

1-2) Checks if the contents of lhs and rhs are equal, that is, they have the same number of elements and each element in lhs compares equal with the element in rhs at the same position.

harshitpant1 commented 3 years ago

Dang it, I just realized that, I can't confirm how the compiler does the string comparisons. Sorry for wasting your time.