-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[libc++] Implement ranges::iota #68494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 44 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
c4a3ccf
[libc++] Implement ranges::iota and ranges::out_value_result
jamesETsmith 1b808ec
Merge branch 'main' of https://github.com/llvm/llvm-project into rang…
jamesETsmith 574c94c
[libc++] Implement ranges::iota: update module and docs info
jamesETsmith e4cfe00
[libc++] Implement ranges::iota: fixing formatting issues for out_val…
jamesETsmith 7cdfea2
[libc++] Implement ranges::iota: Cleaning up tests for ranges::iota a…
jamesETsmith a1d015c
[libc++] Implement ranges::iota: Cleaning up tests for ranges::iota a…
jamesETsmith ab4c67d
[libc++] Implement ranges::iota: Using clang-format-17 to make CI che…
jamesETsmith c44d7d6
Merge branch 'main' of https://github.com/llvm/llvm-project into rang…
jamesETsmith a455f42
[libc++] Implement ranges::iota: Adding helper function to implementa…
jamesETsmith 08e3c77
[libc++] Implement ranges::iota: Adding tests to ranges_robust_agains…
jamesETsmith e658ec2
[libc++] Implement ranges::iota: Merging with main and handling confl…
jamesETsmith 67fcac1
[libc++] Implement ranges::iota: Fixing formatting problems
jamesETsmith b132784
[libc++] Implement ranges::iota: Addressing comments about out_value_…
jamesETsmith 88e271a
[libc++] Implement ranges::iota: Updating Proxy<T> in test_iterators.…
jamesETsmith ff5bf79
[libc++] Implement ranges::iota: Fixing some of the buildkite errors,…
jamesETsmith b8f07b8
[libc++] Implement ranges::iota: Explicitly adding #include for range…
jamesETsmith a4d34fd
[libc++] Implement ranges::iota: Explicitly adding #include for range…
jamesETsmith 334088f
:Merge branch 'main' of https://github.com/llvm/llvm-project into ran…
jamesETsmith 8153244
[libc++] Implement ranges::iota: Adding #ifdef _LIBCPP_STD_VER >= 23 …
jamesETsmith a872e39
[libc++] Implement ranges::iota: Missing a few more #if TEST_STD_VER …
jamesETsmith 0f538aa
Merge branch 'main' of https://github.com/llvm/llvm-project into rang…
jamesETsmith b84859b
[libc++] Implement ranges::iota: Removing several of the ranges_robus…
jamesETsmith 3bd4c6d
[libc++] Implement ranges::iota: Updating with upstream main and reso…
jamesETsmith 6be79e2
[libc++] Implement ranges::iota: Updating with upstream and fixing co…
jamesETsmith 7cde8ed
Merge branch 'main' of https://github.com/llvm/llvm-project into rang…
jamesETsmith 074d685
Merge branch 'main' of https://github.com/llvm/llvm-project into rang…
jamesETsmith 72125ea
[libc++] Implement ranges::iota: Updating with upstream and adding st…
jamesETsmith ce909e8
Merge branch 'main' of https://github.com/llvm/llvm-project into rang…
jamesETsmith 028ce92
[libc++] Implement ranges::iota: Fixing formatting problems with test…
jamesETsmith b3f260e
[libc++] Implement ranges::iota: Improving ranges::iota tests and doc…
jamesETsmith be7faa6
[libc++] Implement ranges::iota: Removing unnecessary namespaces in r…
jamesETsmith 20b848b
[libc++] Implement ranges::iota: Refactoring some of Proxy's member f…
jamesETsmith 2803493
[libc++] Implement ranges::iota: Undoing some problematic additions t…
jamesETsmith 5f0389c
[libc++] Implement ranges::iota: Fixing review comments on ranges.iot…
jamesETsmith 79d6cc5
[libc++] Implementing ranges::iota: Adding user-defined type tests an…
jamesETsmith 07b8183
[libc++] Implementing ranges::iota: Reverting to original strategy fo…
jamesETsmith 3d5ad73
[libc++] Implementing ranges::iota: Updating branch with llvm-project…
jamesETsmith fd81400
[libc++] Implementing ranges::iota: Needed to include __undef_macros …
jamesETsmith 3285f4e
[libc++] Implementing ranges::iota: Fixing autogenerated version.vers…
jamesETsmith cea6379
Merge branch 'main' of github.com:llvm/llvm-project into ranges_iota
jamesETsmith 3f0670f
[libc++] Implementing ranges::iota: Simplifying some tests, adding st…
jamesETsmith a7e77b1
[libc++] Implementing ranges::iota: Updating with upstream main and r…
jamesETsmith d50b7a1
[libc++] Implementing ranges::iota: Accidentally manually updated the…
jamesETsmith b4008ad
[libc++] Implementing ranges::iota: Cleanup and addressing comments f…
jamesETsmith 240d4f0
[libc++] Implementing ranges::iota: Updating with upstream main
jamesETsmith 8f5ffc3
[libc++] Implementing ranges::iota: Including out_value_result got st…
jamesETsmith b99c8d8
[libc++] Implementing ranges::iota: Needed to add __iterator/concepts…
jamesETsmith dc29b80
[libc++] implementing ranges::iota: Fixing the Cxx23Paper.csv doc for…
jamesETsmith e325de4
[libc++] implementing ranges::iota: Switching the wording in Cxx23Pap…
jamesETsmith 913a8d8
[libc++] implementing ranges::iota: the header for out_value_result.h…
jamesETsmith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// -*- C++ -*- | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// 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_OUT_VALUE_RESULT_H | ||
#define _LIBCPP___ALGORITHM_OUT_VALUE_RESULT_H | ||
|
||
#include <__concepts/convertible_to.h> | ||
#include <__config> | ||
#include <__utility/move.h> | ||
|
||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
# pragma GCC system_header | ||
#endif | ||
|
||
_LIBCPP_PUSH_MACROS | ||
#include <__undef_macros> | ||
|
||
_LIBCPP_BEGIN_NAMESPACE_STD | ||
|
||
#if _LIBCPP_STD_VER >= 23 | ||
|
||
namespace ranges { | ||
|
||
template <class _OutIter1, class _ValType1> | ||
struct out_value_result { | ||
_LIBCPP_NO_UNIQUE_ADDRESS _OutIter1 out; | ||
_LIBCPP_NO_UNIQUE_ADDRESS _ValType1 value; | ||
|
||
template <class _OutIter2, class _ValType2> | ||
requires convertible_to<const _OutIter1&, _OutIter2> && convertible_to<const _ValType1&, _ValType2> | ||
_LIBCPP_HIDE_FROM_ABI constexpr operator out_value_result<_OutIter2, _ValType2>() const& { | ||
return {out, value}; | ||
} | ||
|
||
template <class _OutIter2, class _ValType2> | ||
requires convertible_to<_OutIter1, _OutIter2> && convertible_to<_ValType1, _ValType2> | ||
_LIBCPP_HIDE_FROM_ABI constexpr operator out_value_result<_OutIter2, _ValType2>() && { | ||
return {std::move(out), std::move(value)}; | ||
} | ||
}; | ||
|
||
} // namespace ranges | ||
|
||
#endif // _LIBCPP_STD_VER >= 23 | ||
|
||
_LIBCPP_END_NAMESPACE_STD | ||
|
||
_LIBCPP_POP_MACROS | ||
|
||
#endif // _LIBCPP___ALGORITHM_OUT_VALUE_RESULT_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// -*- C++ -*- | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// 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___NUMERIC_RANGES_IOTA_H | ||
#define _LIBCPP___NUMERIC_RANGES_IOTA_H | ||
|
||
#include <__algorithm/out_value_result.h> | ||
#include <__config> | ||
#include <__ranges/access.h> | ||
#include <__ranges/concepts.h> | ||
#include <__ranges/dangling.h> | ||
#include <__utility/as_const.h> | ||
#include <__utility/move.h> | ||
|
||
philnik777 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | ||
# pragma GCC system_header | ||
#endif | ||
|
||
_LIBCPP_PUSH_MACROS | ||
#include <__undef_macros> | ||
|
||
_LIBCPP_BEGIN_NAMESPACE_STD | ||
|
||
#if _LIBCPP_STD_VER >= 23 | ||
namespace ranges { | ||
template <typename _Out, typename _Tp> | ||
using iota_result = ranges::out_value_result<_Out, _Tp>; | ||
|
||
struct __iota_fn { | ||
public: | ||
template <input_or_output_iterator _Out, sentinel_for<_Out> _Sent, weakly_incrementable _Tp> | ||
requires indirectly_writable<_Out, const _Tp&> | ||
_LIBCPP_HIDE_FROM_ABI static constexpr iota_result<_Out, _Tp> operator()(_Out __first, _Sent __last, _Tp __value) { | ||
while (__first != __last) { | ||
*__first = std::as_const(__value); | ||
++__first; | ||
++__value; | ||
} | ||
return {std::move(__first), std::move(__value)}; | ||
} | ||
|
||
template <weakly_incrementable _Tp, ranges::output_range<const _Tp&> _Range> | ||
_LIBCPP_HIDE_FROM_ABI static constexpr iota_result<ranges::borrowed_iterator_t<_Range>, _Tp> | ||
philnik777 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
operator()(_Range&& __r, _Tp __value) { | ||
return operator()(ranges::begin(__r), ranges::end(__r), std::move(__value)); | ||
} | ||
}; | ||
|
||
inline constexpr auto iota = __iota_fn{}; | ||
} // namespace ranges | ||
|
||
#endif // _LIBCPP_STD_VER >= 23 | ||
|
||
_LIBCPP_END_NAMESPACE_STD | ||
|
||
_LIBCPP_POP_MACROS | ||
|
||
#endif // _LIBCPP___NUMERIC_RANGES_IOTA_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.