Finds the point where two ranges are different (accepts anything that zips together as a range of 2 things). By default aligns and unrolls 4 times.
namespace eve::algo
{
template <zipped_range_pair Rng>
auto mismatch(Rng&& rng) -> unalinged_t<
decltype(rng.begin())>;
template <zipped_range_pair Rng, typename P>
auto mismatch(Rng&& rng, P p) -> unalinged_t<
decltype(rng.begin())>;
template<typename R1, typename R2>
auto mismatch(R1&& r1, R2&& r2)
requires zip_to_range<R1, R2>
template<typename R1, typename R2, typename P>
auto mismatch(R1&& r1, R2&& r2, P p)
requires zip_to_range<R1, R2>
}
constexpr auto mismatch
a SIMD version of std::mismatch
Definition mismatch.hpp:114
A relaxed_iterator on top of multiple relaxed_iterator. If all of the components are iterator they ha...
Definition zip_iterator.hpp:294
#include <eve/module/core.hpp>
#include <eve/module/algo.hpp>
#include <iostream>
#include <vector>
#include <tts/tts.hpp>
int main()
{
std::vector<int> v = {2,5,-9, 9, 3,-8,2,-5,7,-2,3};
std::vector<int> w = {2,5,-9, -9, -9,-8,2,-5,7,-2,3};
std::cout << " -> v = "
<< tts::as_string(v)
<< "\n";
std::cout << " -> w = "
<< tts::as_string(w)
<< "\n";
std::cout << " <- auto [vv, ww] = eve::algo::mismatch(v, ww);\n";
return x == y || x == -y;
});
std::cout << " <- auto [no_sign_vv, no_sign_ww] = eve::algo::mismatch(v, w, [](...){ });\n";
std::cout <<
" -> mismatch at " <<
eve::read(no_sign_vv) <<
" != " <<
eve::read(no_sign_ww) << std::endl;
}
constexpr auto read
Callable object reading single value from memory.
Definition read.hpp:73