-
Notifications
You must be signed in to change notification settings - Fork 45
Introduce concepts for AccessTraits #1253
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
base: master
Are you sure you want to change the base?
Conversation
| template <typename Traits> | ||
| using AccessTraitsMemorySpaceArchetypeAlias = typename Traits::memory_space; | ||
| template <class T, class U> | ||
| concept not_same_as = !std::same_as<T, U>; |
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.
I added this because there does not seem to be a non-void concept in std, and !std::same_as<void> did not work.
|
@dalg24 Could you please take a look at this PR? |
f07823d to
31bcb16
Compare
31bcb16 to
e8e40e2
Compare
|
Moved 'Concepts' namespace inside |
|
Here are what the errors look like for the In LLVM: So I see two suboptimal messages:
|
|
It seems that the details of notes seem to depend on whether but Which is fine, but is still interesting. |
Introduce complete_type<> concept.
|
@dalg24 I added couple commits:
I do agree with you that if the concepts allowed to specify our error messages, that would be ideal. The only step in that direction I've seen is the [EWG] P1267, but it went nowhere, it seems. The only alternative I see is to name each step of our concepts with some meaningful name, which is a pain. |
The patch introduces three concepts:
AccessTraits,Primitives(same asAccessTraits) andPredicates(AccessTraits+ tag). I put them intoConceptsnamespace.In general, it works fine. One corner point is how it interacts with CTAD.
clangevaluates the right hand side of CTAD before testing the concept, which leads to suboptimal errors instead of ignoring the CTAD (see godbolt). GCC, on the other hand, has a better treatment and properly rejects CTAD due to the unsatisfied requirement.