diff options
author | Hui Xie <hui.xie1990@gmail.com> | 2022-07-08 15:21:40 +0100 |
---|---|---|
committer | Hui Xie <hui.xie1990@gmail.com> | 2022-07-11 06:55:09 +0100 |
commit | 96b674f23cd66e8fee9efde6003dc2032acf58b6 (patch) | |
tree | 3ef06403f3f42382905804a522b321f4a424c2f5 /libcxx/include/__algorithm/iterator_operations.h | |
parent | c13d04e599dd593c53e8f856bb7b71ab914e5934 (diff) | |
download | llvm-96b674f23cd66e8fee9efde6003dc2032acf58b6.tar.gz |
[libc++][ranges] implement `std::ranges::set_intersection`
implement `std::ranges::set_intersection` by reusing the classic `std::set_intersenction`
added unit tests
Differential Revision: https://reviews.llvm.org/D129233
Diffstat (limited to 'libcxx/include/__algorithm/iterator_operations.h')
-rw-r--r-- | libcxx/include/__algorithm/iterator_operations.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libcxx/include/__algorithm/iterator_operations.h b/libcxx/include/__algorithm/iterator_operations.h index c02f9bf649df..3d86f35f5998 100644 --- a/libcxx/include/__algorithm/iterator_operations.h +++ b/libcxx/include/__algorithm/iterator_operations.h @@ -13,6 +13,7 @@ #include <__iterator/advance.h> #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> +#include <__iterator/next.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -24,6 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD struct _RangesIterOps { static constexpr auto advance = ranges::advance; static constexpr auto distance = ranges::distance; + static constexpr auto next = ranges::next; }; #endif @@ -40,6 +42,12 @@ struct _StdIterOps { return std::distance(__first, __last); } + template <class _Iterator> + _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR_AFTER_CXX11 + _Iterator next(_Iterator, _Iterator __last) { + return __last; + } + }; _LIBCPP_END_NAMESPACE_STD |