-
Notifications
You must be signed in to change notification settings - Fork 781
P2387R3 Pipe support for user-defined range adaptors #5285
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
Merged
+66
−8
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -193,6 +193,11 @@ | |
|
||
namespace views { template<class T> inline constexpr @\unspec@ istream = @\unspec@; } | ||
|
||
// \ref{range.adaptor.object}, range adaptor objects | ||
template<class D> | ||
requires is_class_v<D> && @\libconcept{same_as}@<D, remove_cv_t<D>> | ||
class range_adaptor_closure { }; | ||
|
||
// \ref{range.all}, all view | ||
namespace views { | ||
inline constexpr @\unspec@ all = @\unspec@; | ||
|
@@ -3365,10 +3370,10 @@ | |
|
||
\pnum | ||
A \term{range adaptor closure object} is a unary function object that accepts | ||
a \libconcept{viewable_range} argument and returns a \libconcept{view}. For | ||
a \libconcept{range} argument. For | ||
a range adaptor closure object \tcode{C} and an expression \tcode{R} such that | ||
\tcode{decltype((R))} models \libconcept{viewable_range}, the following | ||
expressions are equivalent and yield a \libconcept{view}: | ||
\tcode{decltype((R))} models \libconcept{range}, the following | ||
expressions are equivalent: | ||
\begin{codeblock} | ||
C(R) | ||
R | C | ||
|
@@ -3394,6 +3399,42 @@ | |
The expression \tcode{C | D} is well-formed if and only if | ||
the initializations of the state entities of \tcode{E} are all well-formed. | ||
|
||
\pnum | ||
Given an object \tcode{t} of type \tcode{T}, where | ||
\begin{itemize} | ||
\item | ||
\tcode{t} is a unary function object that accepts a \libconcept{range} argument, | ||
\item | ||
\tcode{T} models \tcode{\libconcept{derived_from}<range_adaptor_closure<T>>}, | ||
\item | ||
\tcode{T} has no other base classes of type \tcode{range_adaptor_closure<U>} for any other type \tcode{U}, and | ||
\item | ||
\tcode{T} does not model \libconcept{range} | ||
\end{itemize} | ||
then the implementation ensures | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (I'm not wild about the use of "then" here, which is trying to make it sound as if the sentence had started with "If t is an object of type T...". Really we should drop the "then" and have a comma after the preceding item. But that's how it was given to us.) |
||
that \tcode{t} is a range adaptor closure object. | ||
|
||
\pnum | ||
The template parameter \tcode{D} for \tcode{range_adaptor_closure} | ||
may be an incomplete type. | ||
If an expression of type \cv{} \tcode{D} | ||
is used as an operand to the \tcode{|} operator, | ||
\tcode{D} shall be complete and | ||
model \tcode{\libconcept{derived_from}<range_adaptor_closure<D>>}. | ||
The behavior of an expression involving an object of type \cv{} \tcode{D} | ||
as an operand to the \tcode{|} operator is undefined | ||
if overload resolution selects a program-defined \tcode{operator|} function. | ||
|
||
\pnum | ||
If an expression of type \cv{} \tcode{U} | ||
is used as an operand to the \tcode{|} operator, | ||
where \tcode{U} has a base class of type \tcode{range_adaptor_closure<T>} | ||
for some type \tcode{T} other than \tcode{U}, the behavior is undefined. | ||
|
||
\pnum | ||
The behavior of a program | ||
that adds a specialization for \tcode{range_adaptor_closure} is undefined. | ||
|
||
\pnum | ||
A \term{range adaptor object} is a | ||
customization point object\iref{customization.point.object} | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.