Skip to content
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

P1206R7 Conversions From Ranges To Containers #2806

Merged
merged 38 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a47b6d0
P1206R7 Conversions From Ranges To Containers
CaseyCarter Dec 19, 2021
a62fe8b
WIP
CaseyCarter Jun 20, 2022
4e59216
Fixes
CaseyCarter Jun 21, 2022
2cb4fe9
fix feature-test macro test
CaseyCarter Jun 21, 2022
b5d02f4
frederick-vs-ja's deque comments
CaseyCarter Jun 22, 2022
5fae89b
factor commonality from forward_list::insert_range_after and ::insert…
CaseyCarter Jun 22, 2022
593e9a1
Fix inadvertent comment damage
CaseyCarter Jun 22, 2022
3b687e8
miscco's review comments
CaseyCarter Jun 24, 2022
ccf85f4
STL's review comments
CaseyCarter Jun 24, 2022
b2a0262
Consistently use `_Iter, _Sent` in container code
CaseyCarter Jun 24, 2022
e75816a
Revert accidental change to libcxx/usual_matrix.lst
CaseyCarter Jun 24, 2022
3e6b68f
enum_class{underlying_value} is C++17
CaseyCarter Jun 24, 2022
29feac1
cpplearner's comment; Update LWG issue number
CaseyCarter Jun 27, 2022
073cc1a
Review comments
CaseyCarter Jul 23, 2022
06614a3
Revert clang-format noise
CaseyCarter Jul 25, 2022
56eadd0
clang-format
CaseyCarter Jul 25, 2022
1612f7b
Nicole's review comments
CaseyCarter Jul 28, 2022
412e87d
Rename adaptor_adaptor to accessible_adaptor
CaseyCarter Jul 28, 2022
baa2afa
Surely I don't need to run _all_ the tests before pushing??!?
CaseyCarter Jul 28, 2022
e213a64
Merge branch 'main' into p1206
StephanTLavavej Aug 8, 2022
148de4b
Fix comment typo.
StephanTLavavej Aug 8, 2022
748e8fd
Fix merge: apply `_Is_meow_iter_v` => `_Is_cpp17_meow_iter_v` renaming.
StephanTLavavej Aug 8, 2022
6eafabd
Rename to P1206R7_forward_list_insert_range_after.
StephanTLavavej Aug 8, 2022
cb3b81d
Add `// Validate non-views` comments.
StephanTLavavej Aug 8, 2022
d05cbd8
Reorder definitions: _UFirst then _ULast.
StephanTLavavej Aug 8, 2022
8ffc780
Reduce scope of clang-format suppression.
StephanTLavavej Aug 8, 2022
bb956af
Change `std::` to `_STD`.
StephanTLavavej Aug 8, 2022
7641514
Qualify `_RANGES to`.
StephanTLavavej Aug 8, 2022
d424e80
Simplify how access control interacts with ifdefs.
StephanTLavavej Aug 8, 2022
7883bd4
Fix comments.
StephanTLavavej Aug 8, 2022
371deba
Avoid redundant namespace alias.
StephanTLavavej Aug 8, 2022
b983211
constexpr string/vector are always available, reported VSO-1588614.
StephanTLavavej Aug 8, 2022
e9c4a4e
Avoid redundant `constexpr const`.
StephanTLavavej Aug 8, 2022
b9d8186
Drop unnecessary `std::` in tests.
StephanTLavavej Aug 8, 2022
a4932c5
Use `bool` for expected arrays.
StephanTLavavej Aug 8, 2022
5582f29
Apply `defined(__cpp_lib_concepts)` cleanup.
StephanTLavavej Aug 8, 2022
4c9dc79
Chack construction from `const from_range_t&` instead of `from_range_t`
CaseyCarter Aug 8, 2022
d2cc9ed
`_Copy_n_unchecked` is a zombie
CaseyCarter Aug 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 3 additions & 53 deletions stl/inc/algorithm
Original file line number Diff line number Diff line change
Expand Up @@ -254,56 +254,6 @@ namespace ranges {
return {_STD move(in), found};
}
};

// clang-format off
template <forward_iterator _Wrapped, class _Se>
requires sentinel_for<remove_cvref_t<_Se>, _Wrapped>
_NODISCARD constexpr auto _Get_final_iterator_unwrapped(const _Unwrapped_t<_Wrapped>& _UFirst, _Se&& _Last) {
// clang-format on
// find the iterator in [_UFirst, _Get_unwrapped(_Last)) which equals _Get_unwrapped(_Last) [possibly O(N)]
auto _ULast = _Get_unwrapped(_STD forward<_Se>(_Last));
if constexpr (is_same_v<remove_cvref_t<_Se>, _Wrapped>) {
return _ULast;
} else if constexpr (sized_sentinel_for<remove_cvref_t<_Se>, _Wrapped>) {
return _RANGES next(_UFirst, _ULast - _UFirst);
} else {
return _RANGES next(_UFirst, _STD move(_ULast));
}
}

template <forward_range _Rng>
_NODISCARD constexpr auto _Get_final_iterator_unwrapped(_Rng& _Range) {
// find the (unwrapped) iterator in _Range which equals _Uend(_Range) [possibly O(N)]
if constexpr (common_range<_Rng>) {
if constexpr (same_as<_Unwrapped_t<_RANGES iterator_t<_Rng>>, decltype(_Uend(_Range))>) {
return _Uend(_Range);
} else {
return _Get_unwrapped(_RANGES end(_Range));
}
} else if constexpr (sized_range<_Rng>) {
return _RANGES next(_Ubegin(_Range), _RANGES distance(_Range));
} else {
return _RANGES next(_Ubegin(_Range), _Uend(_Range));
}
}

template <forward_range _Rng>
_NODISCARD constexpr auto _Get_final_iterator_unwrapped(_Rng& _Range, const _Unwrapped_t<iterator_t<_Rng>>& _Mid) {
// find the (unwrapped) iterator in _Range which equals _Uend(_Range) [possibly O(N)]
// Pre: [ranges::begin(_Range), _Mid) and [_Mid, ranges::end(_Range)) denote ranges
if constexpr (common_range<_Rng>) {
return _Uend(_Range);
} else if constexpr (sized_range<_Rng>) {
const auto _Dist = _RANGES distance(_Range);
if constexpr (sized_sentinel_for<_Unwrapped_t<iterator_t<_Rng>>, _Unwrapped_t<iterator_t<_Rng>>>) {
return _RANGES next(_Mid, _Dist - (_Mid - _Ubegin(_Range)));
} else {
return _RANGES next(_Ubegin(_Range), _Dist);
}
} else {
return _RANGES next(_Mid, _Uend(_Range));
}
}
} // namespace ranges
#endif // __cpp_lib_concepts

Expand Down Expand Up @@ -1449,9 +1399,9 @@ namespace ranges {
auto _UFirst = _Get_unwrapped_n(_STD move(_First), _Count);
if constexpr (_Iter_copy_cat<decltype(_UFirst), _Out>::_Bitcopy_assignable) {
if (!_STD is_constant_evaluated()) {
auto _Final = _UFirst + _Count;
_Result = _Copy_memmove(_STD move(_UFirst), _Final, _STD move(_Result));
_Seek_wrapped(_First, _STD move(_Final));
_Result = _Copy_memmove_n(_UFirst, static_cast<size_t>(_Count), _STD move(_Result));
_UFirst += _Count;
_Seek_wrapped(_First, _STD move(_UFirst));
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
return {_STD move(_First), _STD move(_Result)};
}
}
Expand Down
Loading