Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
find_if_not.hpp
Go to the documentation of this file.
1// Copyright 2026, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#ifndef INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_FIND_IF_NOT_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_FIND_IF_NOT_HPP_
7
8// IWYU pragma: private, include <algorithm>
9// IWYU pragma: friend "stdlib_detail/.*"
10
11// parasoft-begin-suppress CERT_CPP-DCL58-a-2 "Part of a standard library implementation"
12// parasoft-begin-suppress AUTOSAR-A17_6_1-a-2 "Part of a standard library implementation"
13
14#include "arene/base/algorithm/detail/traits.hpp"
20
21namespace std {
22// parasoft-begin-suppress AUTOSAR-M3_3_2-a-2 "False positive: inline function used in multiple translation units"
23/// @brief Find the first position in a range where the predicate is false. Returns the end of the range if there is no
24/// such position.
25/// @tparam InputIterator The type of the iterator used to mark the range
26/// @tparam Predicate The type of the predicate
27/// @param first The start of the range
28/// @param last The end of the range
29/// @param pred The predicate
30/// @return The first iterator in @c [first,last) for which @c pred(*it) is @c false, or @c last if no such iterator
31/// exists
32/// @pre @c InputIterator must be an input iterator
33/// @pre @c [first,last) must denote a valid range
34/// @pre @c pred(*first) must be well-formed and return a boolean-testable value
35template <
36 typename InputIterator,
37 typename Predicate,
42 nullptr>
43auto find_if_not(InputIterator first, InputIterator last, Predicate pred) noexcept(
44 noexcept(arene::base::advance(first, 1)) && //
45 noexcept(first != last) && //
46 noexcept(!pred(*first))
47) -> InputIterator {
48 while (first != last) {
49 if (!pred(*first)) {
50 break;
51 }
52 arene::base::advance(first, 1);
53 }
54 return first;
55}
56// parasoft-end-suppress AUTOSAR-M3_3_2-a-2
57
58} // namespace std
59
60#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_FIND_IF_NOT_HPP_
Provides a backport of C++17's constexpr std::advance.
Public export header for the constraints subpackage.
constexpr bool is_predicate_v
backport for the C++20 predicate concept
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
STL namespace.
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41
auto find_if_not(InputIterator first, InputIterator last, Predicate pred) noexcept(noexcept(arene::base::advance(first, 1)) &&//noexcept(first !=last) &&//noexcept(!pred(*first))) -> InputIterator
Find the first position in a range where the predicate is false. Returns the end of the range if ther...
Definition find_if_not.hpp:43