[libcxx-commits] [libcxx] [libc++] Optimize std::find for segmented iterators (PR #67224)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Dec 8 07:08:39 PST 2023
================
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___ALGORITHM_FIND_SEGMENT_IF_H
+#define _LIBCPP___ALGORITHM_FIND_SEGMENT_IF_H
+
+#include <__config>
+#include <__iterator/segmented_iterator.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+// __find_segment_if is a utility function for optimizing iteration over segmented iterators linearly.
+// [__first, __last) has to be a segmented range. __pred is expected to take a range of local iterators and the __proj.
+// It returns an iterator to an element, or a one-past-the-end iterator if there was no match. __proj may be
----------------
ldionne wrote:
```suggestion
// It returns an iterator to the first element that satisfies the predicate, or a one-past-the-end iterator if there was no match. __proj may be
```
https://github.com/llvm/llvm-project/pull/67224
More information about the libcxx-commits
mailing list