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

Implement LWG-3798 Rvalue reference and iterator_category #3359

Merged
merged 6 commits into from
Jan 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion stl/inc/__msvc_iter_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ struct _Iter_traits_category2<false> {

// clang-format off
template <class _It>
concept _Cpp17_forward_delta = constructible_from<_It> && is_lvalue_reference_v<iter_reference_t<_It>>
concept _Cpp17_forward_delta = constructible_from<_It> && is_reference_v<iter_reference_t<_It>>
&& same_as<remove_cvref_t<iter_reference_t<_It>>, typename indirectly_readable_traits<_It>::value_type>
&& requires(_It __i) {
{ __i++ } -> convertible_to<const _It&>;
Expand Down
24 changes: 12 additions & 12 deletions stl/inc/ranges
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ namespace ranges {
is_nothrow_move_constructible_v<_Wi>&& is_nothrow_move_constructible_v<_Bo>) // strengthened
: _Value(_STD move(_Value_)), _Bound(_STD move(_Bound_)) {
if constexpr (totally_ordered_with<_Wi, _Bo>) {
_STL_ASSERT(_Value_ <= _Bound_, "Per N4878 [range.iota.view]/8, the first argument must precede the "
_STL_ASSERT(_Value_ <= _Bound_, "Per N4928 [range.iota.view]/8, the first argument must precede the "
"second when their types are totally ordered.");
}
}
Expand Down Expand Up @@ -2018,7 +2018,7 @@ namespace ranges {
_NODISCARD constexpr _Iterator begin() {
#if _CONTAINER_DEBUG_LEVEL > 0
_STL_VERIFY(
_Pred, "N4861 [range.filter.view]/3 forbids calling begin on a filter_view that holds no predicate");
_Pred, "N4928 [range.filter.view]/3 forbids calling begin on a filter_view that holds no predicate");
#endif // _CONTAINER_DEBUG_LEVEL > 0
if constexpr (forward_range<_Vw>) {
if (this->_Has_cache()) {
Expand Down Expand Up @@ -2091,12 +2091,12 @@ namespace ranges {
template <bool _Const>
requires forward_range<_Maybe_const<_Const, _Vw>>
struct _Category_base<_Const> {
using _Base = _Maybe_const<_Const, _Vw>;
using iterator_category = conditional_t<
is_lvalue_reference_v<invoke_result_t<_Maybe_const<_Const, _Fn>&, range_reference_t<_Base>>>,
conditional_t<derived_from<_Iter_cat_t<iterator_t<_Base>>, contiguous_iterator_tag>,
random_access_iterator_tag, _Iter_cat_t<iterator_t<_Base>>>,
input_iterator_tag>;
using _Base = _Maybe_const<_Const, _Vw>;
using iterator_category =
conditional_t<is_reference_v<invoke_result_t<_Maybe_const<_Const, _Fn>&, range_reference_t<_Base>>>,
conditional_t<derived_from<_Iter_cat_t<iterator_t<_Base>>, contiguous_iterator_tag>,
random_access_iterator_tag, _Iter_cat_t<iterator_t<_Base>>>,
input_iterator_tag>;
};

template <bool _Const>
Expand Down Expand Up @@ -3015,7 +3015,7 @@ namespace ranges {
is_nothrow_move_constructible_v<_Vw>) // strengthened
: _Range(_STD move(_Range_)), _Count{_Count_} {
#if _CONTAINER_DEBUG_LEVEL > 0
_STL_VERIFY(_Count_ >= 0, "Numer of elements to drop must be non-negative (N4861 [range.drop.view]/1");
_STL_VERIFY(_Count_ >= 0, "Number of elements to drop must be non-negative (N4928 [range.drop.view]/1");
#endif // _CONTAINER_DEBUG_LEVEL > 0
}

Expand Down Expand Up @@ -3216,7 +3216,7 @@ namespace ranges {
_NODISCARD constexpr auto begin() {
#if _CONTAINER_DEBUG_LEVEL > 0
_STL_VERIFY(
_Pred, "N4885 [range.drop.while.view] forbids calling begin on a drop_while_view with no predicate");
_Pred, "N4928 [range.drop.while.view]/3 forbids calling begin on a drop_while_view with no predicate");
#endif // _CONTAINER_DEBUG_LEVEL > 0
if constexpr (forward_range<_Vw>) {
if (this->_Has_cache()) {
Expand Down Expand Up @@ -3716,7 +3716,7 @@ namespace ranges {
using _PatternBase = _Maybe_const<_Const, _Pat>;

using iterator_category = conditional_t<
!is_lvalue_reference_v<common_reference_t<range_reference_t<_Inner>, range_reference_t<_PatternBase>>>,
!is_reference_v<common_reference_t<range_reference_t<_Inner>, range_reference_t<_PatternBase>>>,
input_iterator_tag,
conditional_t<common_range<_Inner> && common_range<_PatternBase>
&& derived_from<_Iter_cat_t<iterator_t<_Outer>>, bidirectional_iterator_tag>
Expand Down Expand Up @@ -6483,7 +6483,7 @@ namespace ranges {
is_nothrow_move_constructible_v<_Vw>) /* strengthened */
: _Range(_STD move(_Range_)), _Count{_Count_} {
#if _CONTAINER_DEBUG_LEVEL > 0
_STL_VERIFY(_Count > 0, "The window size must be positive (N4917 [range.slide.view]/1)");
_STL_VERIFY(_Count > 0, "The window size must be positive (N4928 [range.slide.view]/1)");
#endif // _CONTAINER_DEBUG_LEVEL > 0
}

Expand Down
Loading