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/traits.hpp"
22
23namespace std {
24// parasoft-begin-suppress AUTOSAR-M3_3_2-a-2 "False positive: inline function used in multiple translation units"
25/// @brief Check if the predicate is false for every element in the range. Returns @c true if there is no element in the
26/// range for which the predicate returns @c true, @c false otherwise
27/// @tparam InputIterator The type of the iterator used to mark the range
28/// @tparam Predicate The type of the predicate
29/// @param first The start of the range
30/// @param last The end of the range
31/// @param pred The predicate
32/// @return @c true if there is no element in the range @c [first,last) for which @c pred(*it) returns @c true
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>
44auto none_of(InputIterator first, InputIterator last, Predicate pred) noexcept(
45 noexcept(arene::base::make_subrange(first, last)) && //
46 noexcept(pred(*first)) && //
47 noexcept(++first)
48) -> bool {
49 // parasoft-begin-suppress AUTOSAR-A7_1_5-a "False Positive: 'element' has return type of range element, which may
50 // be non-fundamental"
51 for (auto&& element : arene::base::make_subrange(first, last)) {
52 // parasoft-end-suppress AUTOSAR-A7_1_5-a
53 if (pred(std::forward<decltype(element)>(element))) {
54 return false;
55 }
56 }
57 return true;
58}
59// parasoft-begin-suppress AUTOSAR-M3_3_2-a-2
60} // namespace std
61
62#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_NONE_OF_HPP_
Public export header for the constraints subpackage.
constexpr bool is_predicate_v
backport for the C++20 predicate concept
constexpr auto make_subrange(Iterator iterator, Sentinel sentinel) noexcept(std::is_nothrow_move_constructible< Iterator >::value &&//std::is_nothrow_move_constructible< Sentinel >::value) -> make_subrange_detail::iterator_range< Iterator, Sentinel >
Combine an iterator and sentinel into a range type that can be used with range-based for loops.
Definition make_subrange.hpp:98
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 none_of(InputIterator first, InputIterator last, Predicate pred) noexcept(noexcept(arene::base::make_subrange(first, last)) &&//noexcept(pred(*first)) &&//noexcept(++first)) -> bool
Check if the predicate is false for every element in the range. Returns true if there is no element i...
Definition none_of.hpp:44
constexpr auto forward(remove_reference_t< T > &value) noexcept -> T &&
Cast a value to an rvalue if T is an rvalue or rvalue reference, otherwise forward an lvalue referenc...
Definition forward.hpp:24