E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches

◆ find_last_if_not

eve::algo::find_last_if_not = function_with_traits<find_last_if_not_>[find_last_if.get_traits()]
inlineconstexpr

#include <eve/module/algo/algo/find_last.hpp>

#include <eve/algo.hpp>

Callable Signatures

namespace eve::algo
{
template <eve::algo::relaxed_range Rng, typename P>
auto find_if_not(Rng&& rng, P p) -> unaligned_iterator_t<Rng>;
}
unaligned_t< iterator_t< R > > unaligned_iterator_t
Unaligned iterator for a relaxed range.
Definition: ranges_types.hpp:68
constexpr auto find_if_not
a version of eve::algo::find_if where the preicate is negated
Definition: find.hpp:233

Parameters

  • rng: Relaxed range input range to process
  • 'p': Predicate to invert and use

Return value

Iterator on the element found or past the end if not found

See also
find_if

Example

#include <eve/module/core.hpp>
#include <eve/module/algo.hpp>
#include <tts/tts.hpp>
#include <iostream>
#include <vector>
int main()
{
std::vector<int> v{12, 0, 5, -9, 3, 0, 5};
std::cout << " -> v = "
<< tts::as_string(v)
<< "\n";
std::cout << " <- eve::algo::find_if(v, eve::is_eqz) - v.begin() = " << pos - v.begin() << "\n";
std::cout << " <- eve::algo::find_last_if(v, eve::is_eqz) - v.begin() = " << pos_b - v.begin() << "\n";
auto pos_bn = eve::algo::find_last_if_not(v, [](auto x){return x < 0; });
std::cout << " <- eve::algo::find_last_if_not(v, x < 0) - v.begin() = " << pos_bn - v.begin() << "\n";
auto pos_bv = eve::algo::find_last(v, 5);
std::cout << " <- eve::algo::find_last(v, 5) - v.begin() = " << pos_bv - v.begin() << "\n";
return 0;
}
constexpr auto find_if
SIMD version of std::find_if.
Definition: find.hpp:130
constexpr auto find_last_if_not
a version of find_last_if where the preicate is negated
Definition: find_last.hpp:233
constexpr auto find_last
a version of find_last_if with a value to find instead of a predicate to test.
Definition: find_last.hpp:184
constexpr auto find_last_if
SIMD version of std::ranges::find_last_if
Definition: find_last.hpp:135
constexpr auto is_eqz
elementwise callable returning a logical true if and only if the element value is zero.
Definition: is_eqz.hpp:72