Illustrating the generic lexicographical_compare algorithm
#include <iostream>
#include <cassert>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
string s("helio");
string s2("hello");
vector<char> vector1(s.begin(), s.end());
vector<char> vector2(s.begin(), s.end());
// Show that vector1 is lexicographically less than vector2:
bool result = lexicographical_compare(vector1.begin(),vector1.end(), vector2.begin(), vector2.end());
cout << result;
return 0;
}
/*
0
*/
Related examples in the same category