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 //===----------------------------------------------------------------------===// 8 9 #ifndef _LIBCPP___ALGORITHM_RANGES_UNIQUE_COPY_H 10 #define _LIBCPP___ALGORITHM_RANGES_UNIQUE_COPY_H 11 12 #include <__algorithm/in_out_result.h> 13 #include <__algorithm/make_projected.h> 14 #include <__algorithm/unique_copy.h> 15 #include <__concepts/same_as.h> 16 #include <__config> 17 #include <__functional/identity.h> 18 #include <__functional/invoke.h> 19 #include <__functional/ranges_operations.h> 20 #include <__iterator/concepts.h> 21 #include <__iterator/iterator_traits.h> 22 #include <__iterator/readable_traits.h> 23 #include <__iterator/projected.h> 24 #include <__ranges/access.h> 25 #include <__ranges/concepts.h> 26 #include <__ranges/dangling.h> 27 #include <__utility/forward.h> 28 #include <__utility/move.h> 29 30 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 31 # pragma GCC system_header 32 #endif 33 34 #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) 35 36 _LIBCPP_BEGIN_NAMESPACE_STD 37 38 namespace ranges { 39 40 template <class _InIter, class _OutIter> 41 using unique_copy_result = in_out_result<_InIter, _OutIter>; 42 43 namespace __unique_copy { 44 45 struct __fn { 46 47 template <input_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter, class _Proj = identity, 48 indirect_equivalence_relation<projected<_InIter, _Proj>> _Comp = ranges::equal_to> 49 requires indirectly_copyable<_InIter, _OutIter> && 50 (forward_iterator<_InIter> || 51 (input_iterator<_OutIter> && same_as<iter_value_t<_InIter>, iter_value_t<_OutIter>>) || 52 indirectly_copyable_storable<_InIter, _OutIter>) 53 _LIBCPP_HIDE_FROM_ABI constexpr 54 unique_copy_result<_InIter, _OutIter> 55 operator()(_InIter __first, _Sent __last, _OutIter __result, _Comp __comp = {}, _Proj __proj = {}) const { 56 // TODO: implement 57 (void)__first; (void)__last; (void)__result; (void)__comp; (void)__proj; 58 return {}; 59 } 60 61 template <input_range _Range, weakly_incrementable _OutIter, class _Proj = identity, 62 indirect_equivalence_relation<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::equal_to> 63 requires indirectly_copyable<iterator_t<_Range>, _OutIter> && 64 (forward_iterator<iterator_t<_Range>> || 65 (input_iterator<_OutIter> && same_as<range_value_t<_Range>, iter_value_t<_OutIter>>) || 66 indirectly_copyable_storable<iterator_t<_Range>, _OutIter>) 67 _LIBCPP_HIDE_FROM_ABI constexpr 68 unique_copy_result<borrowed_iterator_t<_Range>, _OutIter> 69 operator()(_Range&& __range, _OutIter __result, _Comp __comp = {}, _Proj __proj = {}) const { 70 // TODO: implement 71 (void)__range; (void)__result; (void)__comp; (void)__proj; 72 return {}; 73 } 74 75 }; 76 77 } // namespace __unique_copy 78 79 inline namespace __cpo { 80 inline constexpr auto unique_copy = __unique_copy::__fn{}; 81 } // namespace __cpo 82 } // namespace ranges 83 84 _LIBCPP_END_NAMESPACE_STD 85 86 #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) 87 88 #endif // _LIBCPP___ALGORITHM_RANGES_UNIQUE_COPY_H 89