Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
none_of.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_NONE_OF_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_NONE_OF_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/type_traits/is_predicate.hpp"
18#include "arene/base/type_traits/iterator_category_traits.hpp"
19#include "arene/base/utility/make_subrange.hpp"
20#include "stdlib/include/stdlib_detail/declval.hpp"
21#include "stdlib/include/stdlib_detail/enable_if.hpp"
22#include "stdlib/include/stdlib_detail/forward.hpp"
23
24namespace std {
25// parasoft-begin-suppress AUTOSAR-M3_3_2-a-2 "False positive: inline function used in multiple translation units"
26/// @brief Check if the predicate is false for every element in the range. Returns @c true if there is no element in the
27/// range for which the predicate returns @c true, @c false otherwise
28/// @tparam InputIterator The type of the iterator used to mark the range
29/// @tparam Predicate The type of the predicate
30/// @param first The start of the range
31/// @param last The end of the range
32/// @param pred The predicate
33/// @return @c true if there is no element in the range @c [first,last) for which @c pred(*it) returns @c true
34/// @pre @c InputIterator must be an input iterator
35/// @pre @c [first,last) must denote a valid range
36/// @pre @c pred(*first) must be well-formed and return a boolean-testable value
37template <
38 typename InputIterator,
39 typename Predicate,
44 nullptr>
46 noexcept(arene::base::make_subrange(first, last)) && //
47 noexcept(pred(*first)) && //
48 noexcept(++first)
49) -> bool {
50 // parasoft-begin-suppress AUTOSAR-A7_1_5-a "False Positive: 'element' has return type of range element, which may
51 // be non-fundamental"
52 for (auto&& element : arene::base::make_subrange(first, last)) {
53 // parasoft-end-suppress AUTOSAR-A7_1_5-a
54 if (pred(std::forward<decltype(element)>(element))) {
55 return false;
56 }
57 }
58 return true;
59}
60// parasoft-begin-suppress AUTOSAR-M3_3_2-a-2
61} // namespace std
62
63#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_NONE_OF_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