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/functional.hpp"
15#include "arene/base/algorithm/detail/traits.hpp"
16#include "arene/base/constraints.hpp"
17#include "arene/base/iterator/advance.hpp"
18#include "arene/base/type_traits/is_predicate.hpp"
19#include "arene/base/type_traits/iterator_category_traits.hpp"
20#include "stdlib/include/stdlib_detail/enable_if.hpp"
21
22namespace std {
23// parasoft-begin-suppress AUTOSAR-M3_3_2-a-2 "False positive: inline function used in multiple translation units"
24/// @brief Find the first position in a range where the predicate is false. Returns the end of the range if there is no
25/// such position.
26/// @tparam InputIterator The type of the iterator used to mark the range
27/// @tparam Predicate The type of the predicate
28/// @param first The start of the range
29/// @param last The end of the range
30/// @param pred The predicate
31/// @return The first iterator in @c [first,last) for which @c pred(*it) is @c false, or @c last if no such iterator
32/// exists
33/// @pre @c InputIterator must be an input iterator
34/// @pre @c [first,last) must denote a valid range
35/// @pre @c pred(*first) must be well-formed and return a boolean-testable value
36template <
37 typename InputIterator,
38 typename Predicate,
43 nullptr>
45 noexcept(arene::base::advance(first, 1)) && //
46 noexcept(first != last) && //
47 noexcept(!pred(*first))
48) -> InputIterator {
49 while (first != last) {
50 if (!pred(*first)) {
51 break;
52 }
53 arene::base::advance(first, 1);
54 }
55 return first;
56}
57// parasoft-end-suppress AUTOSAR-M3_3_2-a-2
58
59} // namespace std
60
61#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_FIND_IF_NOT_HPP_
constexpr auto operator()(::arene::base::result< void, E > const &value) const noexcept(noexcept(hash< E >{}(std::declval< E const & >()))) -> std::size_t
Calculate the hash of a result.
Definition result.hpp:1827