Ranges <range> machinery #82
Merged
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.
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::rangesand adds the<ranges>header. Primarily consists of the range access customization point objects:ranges::beginranges::endranges::cbeginranges::cendranges::rbeginranges::rendranges::crbeginranges::crendranges::sizeranges::emptyranges::dataranges::cdataand range concepts:
ranges::rangeranges::output_rangeranges::input_rangeranges::forward_rangeranges::bidirectional_rangeranges::random_access_rangeranges::contiguous_rangeranges::sized_rangeranges::viewranges::common_rangeand the associated type aliases:
ranges::iterator_tranges::sentinel_tranges::range_value_tranges::range_reference_tranges::range_difference_tranges::range_rvalue_reference_tAdds
<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_CXX20directly controls" section of<yvals_core.h>.Touches
<regex>,<set>, and<unordered_set>to add partial specializations ofranges::enable_viewformatch_resultsand(unordered_)?multi?setas mandated by the WD to override the heuristic.Partially implements P1474R1 "Helpful pointers for
ContiguousIterator":pointer_traitsfrom<xmemory>andto_addressfrom<memory>up into<xutility>to_addressexpression requirement tocontiguous_iteratorconcept, and updateP0896R4_ranges_iterator_machineryappropriatelyranges::data(but notview_interfacesince it isn't yet implemented)Drive-by:
pointer_traits::_Reftypeby eschewingadd_lvalue_reference_t.reverse_iterator's constructors andmake_reverse_iteratorsoranges::rbeginandranges::rendcan benoexceptin more cases_Rngas the template parameter name for models ofstd::ranges::range, rename a local variable_Rngto_Generatorin<random>