forked from lwg/issues
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatic update from GitHub Actions workflow
- Loading branch information
github-actions
committed
Nov 18, 2023
1 parent
5bdae09
commit 66f9638
Showing
22 changed files
with
519 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" | ||
"http://www.w3.org/TR/html4/strict.dtd"> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Issue 4012: common_view::begin/end are missing the simple-view check</title> | ||
<style type="text/css"> | ||
p {text-align:justify} | ||
li {text-align:justify} | ||
blockquote.note | ||
{ | ||
background-color:#E0E0E0; | ||
padding-left: 15px; | ||
padding-right: 15px; | ||
padding-top: 1px; | ||
padding-bottom: 1px; | ||
} | ||
ins {background-color:#A0FFA0} | ||
del {background-color:#FFA0A0} | ||
table {border-collapse: collapse;} | ||
@media (prefers-color-scheme: dark) { | ||
html { | ||
color: #ddd; | ||
background-color: black; | ||
} | ||
ins { | ||
background-color: #225522 | ||
} | ||
del { | ||
background-color: #662222 | ||
} | ||
a { | ||
color: #6af | ||
} | ||
a:visited { | ||
color: #6af | ||
} | ||
blockquote.note | ||
{ | ||
background-color: rgba(255, 255, 255, .10) | ||
} | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<hr> | ||
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#New">New</a> status.</em></p> | ||
<h3><a name="4012" href="lwg-active.html#4012">4012</a>. <tt>common_view::begin/end</tt> are missing the <tt><i>simple-view</i></tt> check</h3> | ||
<p><b>Section:</b> 26.7.19.2 <a href="https://wg21.link/range.common.view">[range.common.view]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a> | ||
<b>Submitter:</b> Hewill Kang <b>Opened:</b> 2023-11-11 <b>Last modified:</b> 2023-11-18</p> | ||
<p><b>Priority: </b>Not Prioritized | ||
</p> | ||
<p><b>View all other</b> <a href="lwg-index.html#range.common.view">issues</a> in [range.common.view].</p> | ||
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p> | ||
<p><b>Discussion:</b></p> | ||
<p> | ||
<tt>common_view::begin/end</tt> have exactly the same implementation as their corresponding <tt>const</tt> versions, | ||
which implies that when the underlying <tt>V</tt> satisfies <tt><i>simple-view</i></tt>, it is sufficient to | ||
just provide <tt>const</tt>-qualified members. | ||
</p> | ||
|
||
|
||
<p id="res-4012"><b>Proposed resolution:</b></p> | ||
<p> | ||
This wording is relative to <a href="https://wg21.link/N4964">N4964</a>. | ||
</p> | ||
|
||
<ol> | ||
|
||
<li><p>Modify 26.7.19.2 <a href="https://wg21.link/range.common.view">[range.common.view]</a> as indicated:</p> | ||
|
||
<blockquote><pre> | ||
namespace std::ranges { | ||
template<view V> | ||
requires (!common_range<V> && copyable<iterator_t<V>>) | ||
class common_view : public view_interface<common_view<V>> { | ||
private: | ||
V <i>base_</i> = V(); // <i>exposition only</i> | ||
|
||
public: | ||
[…] | ||
constexpr auto begin() <ins>requires (!<i>simple-view</i><V>)</ins> { | ||
if constexpr (random_access_range<V> && sized_range<V>) | ||
return ranges::begin(<i>base_</i>); | ||
else | ||
return common_iterator<iterator_t<V>, sentinel_t<V>>(ranges::begin(<i>base_</i>)); | ||
} | ||
|
||
constexpr auto begin() const requires range<const V> { | ||
if constexpr (random_access_range<const V> && sized_range<const V>) | ||
return ranges::begin(<i>base_</i>); | ||
else | ||
return common_iterator<iterator_t<const V>, sentinel_t<const V>>(ranges::begin(<i>base_</i>)); | ||
} | ||
|
||
constexpr auto end() <ins>requires (!<i>simple-view</i><V>)</ins> { | ||
if constexpr (random_access_range<V> && sized_range<V>) | ||
return ranges::begin(<i>base_</i>) + ranges::distance(<i>base_</i>); | ||
else | ||
return common_iterator<iterator_t<V>, sentinel_t<V>>(ranges::end(<i>base_</i>)); | ||
} | ||
|
||
constexpr auto end() const requires range<const V> { | ||
if constexpr (random_access_range<const V> && sized_range<const V>) | ||
return ranges::begin(<i>base_</i>) + ranges::distance(<i>base_</i>); | ||
else | ||
return common_iterator<iterator_t<const V>, sentinel_t<const V>>(ranges::end(<i>base_</i>)); | ||
} | ||
|
||
[…] | ||
}; | ||
[…] | ||
} | ||
</pre></blockquote> | ||
|
||
</li> | ||
|
||
</ol> | ||
|
||
|
||
|
||
|
||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.