## ◆ lexicographical_compare() [1/2]

template<typename T >
 bool boost::simd::lexicographical_compare ( T const * first1, T const * last1, const T * first2, const T * last2 )

Returns true if the range [first1, last1) is lexicographically less than the second range [first2, last2), and false otherwise.

Parameters
 first1,last1 - the first range of elements to compare first2,last2 - the second range of elements to compare
Requirement
• first1 , last1 first2 , last2 must be pointer to Vectorizable type.
Example:
#include <boost/simd/algorithm/lexicographical_compare.hpp>
#include <boost/simd/function/inc.hpp>
#include <iostream>
#include <vector>
int main()
{
std::vector<float> c{1.f, 2.f, 2.f, 3.f, 4.f, 5.f, 6.f};
std::vector<float> d{1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f};
bool b1 = boost::simd::lexicographical_compare( d.data(), d.data()+7, d.data(), d.data()+7);
bool b2 = boost::simd::lexicographical_compare( c.data(), c.data()+7, d.data(), d.data()+7);
bool b3 = boost::simd::lexicographical_compare( c.data(), c.data()+7, c.data(), c.data()+5);
bool b4 = boost::simd::lexicographical_compare( d.data(), d.data()+7, c.data(), c.data()+5);
bool b5 = boost::simd::lexicographical_compare( c.data(), c.data()+5, c.data(), c.data()+7);
std::cout << "b1 " << b1 << '\n';
std::cout << "b2 " << b2 << '\n';
std::cout << "b3 " << b3 << '\n';
std::cout << "b4 " << b4 << '\n';
std::cout << "b5 " << b5 << '\n';
return 0;
}
Possible output:
b1 0
b2 1
b3 0
b4 0
b5 1