[Cs3] vector comparison
Mikhail Nesterenko
mikhail at cs.kent.edu
Tue Sep 16 13:11:53 EDT 2014
CS3 students,
I looked up vector comparison standard. The comparison is
lexicographical. Meaning that vector v1 is less than v2 if the
first unequal element in v1 is less than in v2; or if v1 has the same
elements but shorter than v2. For example:
vector <int> v1 = {1, 2, 3, 4},
v2 = {1, 2, 3, 5};
v1 is less than v2
vector <int> v3 = {1, 2, 3},
v4 = {1, 2, 3, 4};
v3 is less than v4
More details are here:
http://en.cppreference.com/w/cpp/algorithm/lexicographical_compare
Oh, and here is what I put in my .bashrc file to invoke clang as c++
alias c++="clang++ -std=c++11"
Thanks,
--
Mikhail
More information about the cs3
mailing list