This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
3381.begin
and data
must agree for contiguous_range
Section: 25.4.6 [range.refinements] Status: C++20 Submitter: Casey Carter Opened: 2020-01-25 Last modified: 2021-02-25
Priority: 0
View all other issues in [range.refinements].
View all issues with C++20 status.
Discussion:
The definition of the contiguous_range
concept in 25.4.6 [range.refinements]/2 requires that ranges::data(r)
be valid for a contiguous_range r
, but fails to impose the obvious semantic requirement that to_address(ranges::begin(r)) == ranges::data(r)
. In other words, data
and begin
must agree so that [begin(r), end(r))
and the counted range data(r) + [0, size(r))
(this is the new "counted range" specification syntax per working draft issue 2932) denote the same sequence of elements.
[2020-02 Prioritized as IMMEDIATE Monday morning in Prague]
Proposed resolution:
This wording is relative to N4849.
Modify 25.4.6 [range.refinements] as indicated:
-2-
contiguous_range
additionally requires that theranges::data
customization point (25.3.14 [range.prim.data]) is usable with the range.template<class T> concept contiguous_range = random_access_range<T> && contiguous_iterator<iterator_t<T>> && requires(T& t) { { ranges::data(t) } -> same_as<add_pointer_t<range_reference_t<T>>>; };-?- Given an expression
-3- Thet
such thatdecltype((t))
isT&
,T
modelscontiguous_range
only if(to_address(ranges::begin(t)) == ranges::data(t))
.common_range
concept […]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4