tetl
0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
partition_point.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSL-1.0
2
// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4
#
ifndef
TETL_ALGORITHM_PARTITION_POINT_HPP
5
#
define
TETL_ALGORITHM_PARTITION_POINT_HPP
6
7
namespace
etl
{
8
9
/// \brief Examines the partitioned (as if by partition) range [first,
10
/// last) and locates the end of the first partition, that is, the first
11
/// element that does not satisfy p or last if all elements satisfy p.
12
/// \ingroup algorithm
13
template
<
typename
ForwardIt,
typename
Predicate>
14
[[nodiscard]]
constexpr
auto
partition_point
(ForwardIt first, ForwardIt last, Predicate p) -> ForwardIt
15
{
16
for
(; first != last; ++first) {
17
if
(
not
p(*first)) {
18
break
;
19
}
20
}
21
22
return
first;
23
}
24
25
}
// namespace etl
26
27
#
endif
// TETL_ALGORITHM_PARTITION_POINT_HPP
etl::partition_point
constexpr auto partition_point(ForwardIt first, ForwardIt last, Predicate p) -> ForwardIt
Examines the partitioned (as if by partition) range [first, last) and locates the end of the first pa...
Definition
partition_point.hpp:14
etl
Definition
adjacent_find.hpp:9
include
etl
_algorithm
partition_point.hpp
Generated on Sun Sep 7 2025 19:14:46 for tetl by
1.9.8