-
Notifications
You must be signed in to change notification settings - Fork 116
[oneTBB] Improve named requirements to better deal with value categories #647
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
Changes from 14 commits
162fed2
b2431ce
2c5ebc0
f0cc309
68826e1
c47c112
a940d5c
b724eb5
17fdde7
d549142
b13abab
dfa3e02
3592490
22cdbe5
26c0564
01133ea
011dfb1
ac632fb
594bd03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,54 +7,44 @@ ParallelForEachBody | |||||
| =================== | ||||||
| **[req.parallel_for_each_body]** | ||||||
|
|
||||||
| A type `Body` satisfies `ParallelForBody` if it meets the `Function Objects` | ||||||
| requirements described in the [function.objects] section of the ISO C++ standard. | ||||||
| It should also meet one of the following requirements: | ||||||
| A type `Body` satisfies `ParallelForEachBody` if it meets the `Function Objects` | ||||||
| requirements described in the [function.objects] section of the ISO C++ standard, | ||||||
| as well as it meets exactly one of the following two requirements for ``operator()``: | ||||||
|
||||||
| as well as it meets exactly one of the following two requirements for ``operator()``: | |
| as well as it meets exactly one of the following two alternative requirements for ``operator()``: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, adding the word "alternative" makes sense.
We can relax the requirements later if necessary, but we cannot make it stronger later without breaking compatibility.
For example, is it possible to make it to prefer the one with the feeder?
If the operator with a feeder is always preferred (which is the only reasonable choice really), why the one without the feeder is ever there? Also, the body can always ignore the feeder if it does not need to use it.
a use case with type hierarchy where instances of the base do not need to add additional work, while the derived classes may include more sophisticated processing. As far as I understand, the design where only one type of the signature can be present makes such inheritance impossible.
I do not get how a type hierarchy is relevant. The dereferenced iterator gives a very specific type. It can be a pointer-to-base, of course, but then the decision of using or not using the feeder is done at runtime, not at compile time. At compile time, the parameter of the operator should be either the base class or the derived class, but not both. If the processing is different, two different body types for parallel_for_each seemingly make more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the one without the feeder is ever there?
I tried to come up with the example, where "the one without feeder" part cannot be easily changed, but whose implementation is desired to be reused.
but then the decision of using or not using the feeder is done at runtime, not at compile time.
I guess, unless the invocation routine is a template itself. Consider this code snippet: https://godbolt.org/z/qbx8eYMcP.
Not sure how realistic such example might be as the Derived::operator() could accept Derived& type just as well.
Uh oh!
There was an error while loading. Please reload this page.