-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Implement ranges::swap_ranges #918
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 all commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
19c2a15
added the move algorithm on line 1265 of algorithm and created a new …
ahanamuk 354e48b
added cmake file
ahanamuk 09f6c9f
passing all tests for ranges move algorithm
ahanamuk 61375a9
updated move algo tests to check that we actually move elems, not jus…
ahanamuk 68640ed
enabled constexpr, cleaned up move algo test
ahanamuk 5277552
removed iostream unused header
ahanamuk 45fb14d
mainly updated formatting/comments based on feedback
ahanamuk 80e349e
Delete cmake
ahanamuk d4f91b0
modified a test
ahanamuk a685197
Merge branch 'move_algo' of https://github.com/ahanamuk/STL
ahanamuk c9f134f
initial fill algo
ahanamuk 93ff947
Passing all fill tests
ahanamuk be947f1
added a test case
ahanamuk 5cb7bfc
minor changes/formatting updates to move
ahanamuk 9170077
updated clang formatting
ahanamuk d4fbaac
initial fill algo
ahanamuk 064684e
comitting untracked stuff
ahanamuk db97692
initial fill and fill_n algo commit
ahanamuk 01ff2e9
working version of fill algo
ahanamuk ea9f61a
fixed up fill_n test
ahanamuk 718624a
Merge branch 'master' into fill_algo_branch1
CaseyCarter d5c055e
Two bugs which are sortof Casey's fault
CaseyCarter 3c89a33
Merge pull request #1 from CaseyCarter/fill
ahanamuk 0462828
initial swap_ranges algo
ahanamuk ba38943
made changes based on initial PR comments
ahanamuk e416462
formatting update
ahanamuk 879c307
initial swap_ranges algo
ahanamuk a5fb6d3
fixing merge conflicts
ahanamuk 604020e
removed fill code
ahanamuk b862691
updated swap_ranges_result and tests
ahanamuk 0859e3d
working on fixing tests
ahanamuk 2bd5cc2
passing tests except STATIC_ASSERT smoke_test() line
ahanamuk f41b2f0
not really a change
ahanamuk 6779e67
squash and rebase onto master
CaseyCarter 1b73b14
merged with casey's updates
ahanamuk 66a59e7
minor updates
ahanamuk 30bfcd8
Revert inadvertent regression of LLVM reference
CaseyCarter 6e3ed4e
first round of code review updates
ahanamuk 49e5b52
more minor updates
ahanamuk 82a66fa
removed fill code
ahanamuk 3f79f08
updated swap_ranges_result and tests
ahanamuk 93a33a7
working on fixing tests
ahanamuk 90104de
passing tests except STATIC_ASSERT smoke_test() line
ahanamuk e349f54
not really a change
ahanamuk 2b2abdb
Library support for C++20 coroutines (#894)
joemmett 301bb37
Update VMSS pool to VS 2019 16.7 Preview 2 (#851)
cbezault 1585269
<algorithm>: Implemented ranges::move (#888)
ahanamuk 3e8e2a5
Updated _MSVC_STL_UPDATE macro (#897)
hikmatfarhat-ndu 0d6b8a0
Cleanup ranges test machinery (#899)
CaseyCarter 1bb78fc
Code cleanups in stl/src (#900)
StephanTLavavej 9e74913
Implement ranges::_Ubegin and ranges::_Uend CPOs (#901)
CaseyCarter 1a7d698
tests: Avoid dialog boxes, prevent stdout from being lost (#906)
StephanTLavavej ccd934b
P0896R4_P1614R2_comparisons/test.cpp: Increase test coverage for MSVC…
SuperWig 86c45a6
Simplify span's representation (#877)
miscco 85d03be
Implement ranges::is_permutation (#892)
CaseyCarter ed2e1ca
Internal headers have extension .hpp (#902)
CaseyCarter 51c7b1a
Fix std::pow's "sufficient additional overloads" (#903)
Berrysoft d874e21
Require VS 2019 16.7 Preview 2 or later. (#911)
StephanTLavavej 7e430e3
resolving merge conflicts
CaseyCarter a72b3b0
More code cleanups in stl/src (#912)
StephanTLavavej 35b7876
squash and rebase onto master
CaseyCarter 8898a05
minor updates
ahanamuk cbe9ebb
Revert inadvertent regression of LLVM reference
CaseyCarter 7afa499
first round of code review updates
ahanamuk 4ab8992
more minor updates
ahanamuk f382c41
Merge branch 'swap_ranges_algo' of https://github.com/ahanamuk/STL in…
ahanamuk eacdd67
Merge branch 'master' into swap_ranges_algo
ahanamuk ba1cebb
Restore CRLF line endings in tests/std/test.lst
CaseyCarter c973d28
Casey renamed `move_only_range` to `basic_borrowed_range`
CaseyCarter 3e3e653
test::without_output_ranges::call should be constexpr
CaseyCarter 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| RUNALL_INCLUDE ..\concepts_matrix.lst |
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,66 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| #include <algorithm> | ||
| #include <array> | ||
| #include <cassert> | ||
| #include <concepts> | ||
| #include <ranges> | ||
| #include <utility> | ||
|
|
||
| #include <range_algorithm_support.hpp> | ||
|
|
||
| constexpr void smoke_test() { | ||
| using ranges::swap_ranges, ranges::swap_ranges_result, ranges::iterator_t; | ||
| using std::same_as; | ||
| using I1 = iterator_t<basic_borrowed_range<int>>; | ||
|
|
||
| // Validate that swap_ranges_result aliases in_in_result | ||
| STATIC_ASSERT(same_as<swap_ranges_result<int, double>, ranges::in_in_result<int, double>>); | ||
|
|
||
| { // Validate ranges overload | ||
| using R = std::array<int, 3>; | ||
| R range1 = {13, 53, 1876}; | ||
| R range2 = {34, 243, 9366}; | ||
| int const expected_output1[] = {34, 243, 9366}; | ||
| int const expected_output2[] = {13, 53, 1876}; | ||
| auto result = swap_ranges(basic_borrowed_range{range1}, basic_borrowed_range{range2}); | ||
| STATIC_ASSERT(same_as<decltype(result), swap_ranges_result<I1, I1>>); | ||
| assert(result.in1 == basic_borrowed_range{range1}.end()); | ||
| assert(result.in2 == basic_borrowed_range{range2}.end()); | ||
| assert(ranges::equal(range1, expected_output1)); | ||
| assert(ranges::equal(range2, expected_output2)); | ||
| } | ||
| { // Validate iterator + sentinel overload | ||
| int range1[] = {13, 53, 1876}; | ||
| int range2[] = {34, 243, 9366}; | ||
| basic_borrowed_range wrapped_range1{range1}; | ||
| basic_borrowed_range wrapped_range2{range2}; | ||
| int const expected_output1[] = {34, 243, 9366}; | ||
| int const expected_output2[] = {13, 53, 1876}; | ||
| auto result = | ||
| swap_ranges(wrapped_range1.begin(), wrapped_range1.end(), wrapped_range2.begin(), wrapped_range2.end()); | ||
| STATIC_ASSERT(same_as<decltype(result), swap_ranges_result<I1, I1>>); | ||
| assert(result.in1 == wrapped_range1.end()); | ||
| assert(result.in2 == wrapped_range2.end()); | ||
| assert(ranges::equal(range1, expected_output1)); | ||
| assert(ranges::equal(range2, expected_output2)); | ||
| } | ||
| } | ||
|
|
||
| int main() { | ||
| #if defined(__clang__) || defined(__EDG__) // TRANSITION, VSO-938163 | ||
| STATIC_ASSERT((smoke_test(), true)); | ||
| #endif // TRANSITION, VSO-938163 | ||
| smoke_test(); | ||
| } | ||
|
|
||
| struct instantiator { | ||
| template <class In1, class In2> | ||
| static void call(In1 in1 = {}, In2 in2 = {}) { | ||
| (void) ranges::swap_ranges(in1, in2); | ||
| (void) ranges::swap_ranges(ranges::begin(in1), ranges::end(in1), ranges::begin(in2), ranges::end(in2)); | ||
| } | ||
| }; | ||
|
|
||
| template void test_in_in<instantiator>(); |
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.