[rtsan] Remove mkfifoat interceptor (#116997)
[llvm-project.git] / libcxx / include / __cxx03 / __algorithm / ranges_unique.h
blob0893127dd9d178578ad6b163f5250966edbe3807
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___ALGORITHM_RANGES_UNIQUE_H
10 #define _LIBCPP___ALGORITHM_RANGES_UNIQUE_H
12 #include <__cxx03/__algorithm/iterator_operations.h>
13 #include <__cxx03/__algorithm/make_projected.h>
14 #include <__cxx03/__algorithm/unique.h>
15 #include <__cxx03/__config>
16 #include <__cxx03/__functional/identity.h>
17 #include <__cxx03/__functional/invoke.h>
18 #include <__cxx03/__functional/ranges_operations.h>
19 #include <__cxx03/__iterator/concepts.h>
20 #include <__cxx03/__iterator/iterator_traits.h>
21 #include <__cxx03/__iterator/permutable.h>
22 #include <__cxx03/__iterator/projected.h>
23 #include <__cxx03/__ranges/access.h>
24 #include <__cxx03/__ranges/concepts.h>
25 #include <__cxx03/__ranges/dangling.h>
26 #include <__cxx03/__ranges/subrange.h>
27 #include <__cxx03/__utility/forward.h>
28 #include <__cxx03/__utility/move.h>
29 #include <__cxx03/__utility/pair.h>
31 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
32 # pragma GCC system_header
33 #endif
35 _LIBCPP_PUSH_MACROS
36 #include <__cxx03/__undef_macros>
38 #if _LIBCPP_STD_VER >= 20
40 _LIBCPP_BEGIN_NAMESPACE_STD
42 namespace ranges {
43 namespace __unique {
45 struct __fn {
46 template <permutable _Iter,
47 sentinel_for<_Iter> _Sent,
48 class _Proj = identity,
49 indirect_equivalence_relation<projected<_Iter, _Proj>> _Comp = ranges::equal_to>
50 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
51 operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
52 auto __ret =
53 std::__unique<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::__make_projected(__comp, __proj));
54 return {std::move(__ret.first), std::move(__ret.second)};
57 template <forward_range _Range,
58 class _Proj = identity,
59 indirect_equivalence_relation<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::equal_to>
60 requires permutable<iterator_t<_Range>>
61 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
62 operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
63 auto __ret = std::__unique<_RangeAlgPolicy>(
64 ranges::begin(__range), ranges::end(__range), std::__make_projected(__comp, __proj));
65 return {std::move(__ret.first), std::move(__ret.second)};
69 } // namespace __unique
71 inline namespace __cpo {
72 inline constexpr auto unique = __unique::__fn{};
73 } // namespace __cpo
74 } // namespace ranges
76 _LIBCPP_END_NAMESPACE_STD
78 #endif // _LIBCPP_STD_VER >= 20
80 _LIBCPP_POP_MACROS
82 #endif // _LIBCPP___ALGORITHM_RANGES_UNIQUE_H