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

Ranges <range> machinery #82

Merged
merged 1 commit into from
Sep 9, 2019
Merged

Ranges <range> machinery #82

merged 1 commit into from
Sep 9, 2019

Conversation

CaseyCarter
Copy link
Member

@CaseyCarter CaseyCarter commented Sep 7, 2019

This is a port of Microsoft-internal PR 200667. [This info is a convenience for internal reviewers, it is NOT part of the commit log.]

Ranges machinery

  • Implements a selection of support machinery in std::ranges and adds the <ranges> header. Primarily consists of the range access customization point objects:

    • ranges::begin
    • ranges::end
    • ranges::cbegin
    • ranges::cend
    • ranges::rbegin
    • ranges::rend
    • ranges::crbegin
    • ranges::crend
    • ranges::size
    • ranges::empty
    • ranges::data
    • ranges::cdata

    and range concepts:

    • ranges::range
    • ranges::output_range
    • ranges::input_range
    • ranges::forward_range
    • ranges::bidirectional_range
    • ranges::random_access_range
    • ranges::contiguous_range
    • ranges::sized_range
    • ranges::view
    • ranges::common_range

    and the associated type aliases:

    • ranges::iterator_t
    • ranges::sentinel_t
    • ranges::range_value_t
    • ranges::range_reference_t
    • ranges::range_difference_t
    • ranges::range_rvalue_reference_t
  • Adds <ranges> - which is mostly empty since the support machinery is defined in <xutility> so as to be visible to <algorithm>

  • Annotates P0896R4 as partially implemented in the "_HAS_CXX20 directly controls" section of <yvals_core.h>.

  • Touches <regex>, <set>, and <unordered_set> to add partial specializations of ranges::enable_view for match_results and (unordered_)?multi?set as mandated by the WD to override the heuristic.

  • Partially implements P1474R1 "Helpful pointers for ContiguousIterator":

    • Push pointer_traits from <xmemory> and to_address from <memory> up into <xutility>
    • Add to_address expression requirement to contiguous_iterator concept, and update P0896R4_ranges_iterator_machinery appropriately
    • Implement the changes to ranges::data (but not view_interface since it isn't yet implemented)
  • Drive-by:

    • Simplify the definition of pointer_traits::_Reftype by eschewing add_lvalue_reference_t.
    • Strengthen reverse_iterator's constructors and make_reverse_iterator so ranges::rbegin and ranges::rend can be noexcept in more cases
    • Since we're using _Rng as the template parameter name for models of std::ranges::range, rename a local variable _Rng to _Generator in <random>

@StephanTLavavej
Copy link
Member

Your description says "Annotate P0896R4 as partially implemented in the "_HAS_CXX20 indirect" section of <yvals_core.h>." but you're actually coalescing that section away.

Also, consider hyperlinking P1474R1 in the description.

Otherwise, looks good to me.

* Implements a selection of support machinery in `std::ranges` and adds the `<ranges>` header. Primarily consists of the range access customization point objects:
  * `ranges::begin`
  * `ranges::end`
  * `ranges::cbegin`
  * `ranges::cend`
  * `ranges::rbegin`
  * `ranges::rend`
  * `ranges::crbegin`
  * `ranges::crend`
  * `ranges::size`
  * `ranges::empty`
  * `ranges::data`
  * `ranges::cdata`

  and range concepts:

  * `ranges::range`
  * `ranges::output_range`
  * `ranges::input_range`
  * `ranges::forward_range`
  * `ranges::bidirectional_range`
  * `ranges::random_access_range`
  * `ranges::contiguous_range`
  * `ranges::sized_range`
  * `ranges::view`
  * `ranges::common_range`

  and the associated type aliases:

  * `ranges::iterator_t`
  * `ranges::sentinel_t`
  * `ranges::range_value_t`
  * `ranges::range_reference_t`
  * `ranges::range_difference_t`
  * `ranges::range_rvalue_reference_t`

* Adds `<ranges>` - which is mostly empty since the support machinery is defined in `<xutility>` so as to be visible to `<algorithm>`

* Annotates [P0896R4](https://wg21.link/p0896r4) as partially implemented in the "`_HAS_CXX20` directly controls" section of `<yvals_core.h>`.

* Touches `<regex>`, `<set>`, and `<unordered_set>` to add partial specializations of `ranges::enable_view` for `match_results` and `(unordered_)?multi?set` as mandated by the WD to override the heuristic.

* Partially implements [P1474R1 "Helpful pointers for `ContiguousIterator`"](https://wg21.link/p1474r1):
  * Push `pointer_traits` from `<xmemory>` and `to_address` from `<memory>` up into `<xutility>`
  * Add `to_address` expression requirement to `contiguous_iterator` concept, and update `P0896R4_ranges_iterator_machinery` appropriately
  * Implement the changes to `ranges::data` (but not `view_interface` since it isn't yet implemented)

* Drive-by:
  * Simplify the definition of `pointer_traits::_Reftype` by eschewing `add_lvalue_reference_t`.
  * Strengthen `reverse_iterator`'s constructors and `make_reverse_iterator` so `ranges::rbegin` and `ranges::rend` can be `noexcept` in more cases
  * Since we're using `_Rng` as the template parameter name for models of `std::ranges::range`, rename a local variable `_Rng` to `_Generator` in `<random>`
@CaseyCarter
Copy link
Member Author

Your description says "Annotate P0896R4 as partially implemented in the "_HAS_CXX20 indirect" section of <yvals_core.h>." but you're actually coalescing that section away.

Corrected.

Also, consider hyperlinking P1474R1 in the description.

I've hyperlinked both P1474R1 and P0896R4. (And updated both the actual commit log and the description above.)

@CaseyCarter CaseyCarter merged commit c5e2e3f into microsoft:master Sep 9, 2019
@CaseyCarter CaseyCarter deleted the dual_200667 branch September 9, 2019 22:31
BillyONeal pushed a commit that referenced this pull request Sep 11, 2019
C4180 "qualifier applied to function type has no meaning; ignored" is emitted from `std::remove_reference<T>` when `T` is a function type or reference to such after applying the changes in #82. We could suppress it locally, but the warning is extremely low-value for the STL in general so let's simply suppress it globally.
CaseyCarter added a commit that referenced this pull request Sep 12, 2019
I experimented with different methods of preparing the dual checkin PR, and chose the wrong one.
@CaseyCarter CaseyCarter mentioned this pull request Mar 16, 2020
@StephanTLavavej StephanTLavavej added the ranges C++20/23 ranges label Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ranges C++20/23 ranges
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants