I know that I can compare string by < > etc. but how to compare char* lexicographically?
Read here: std::lexicographical_compare() has two form
default (1):
template <class InputIterator1, class InputIterator2>
bool lexicographical_compare (InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2);
custom (2):
template <class InputIterator1, class InputIterator2, class Compare>
bool lexicographical_compare (InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2,
Compare comp);
Lexicographical less-than comparison
Returns true if the range [first1,last1) compares lexicographically less than the range [first2,last2).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With