Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aprokop
Copy link
Contributor

@aprokop aprokop commented May 3, 2025

The patch introduces three concepts: AccessTraits, Primitives (same as AccessTraits) and Predicates (AccessTraits + tag). I put them into Concepts namespace.

In general, it works fine. One corner point is how it interacts with CTAD. clang evaluates 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.

@aprokop aprokop added the API User visible interface modifications label May 3, 2025
@aprokop aprokop requested review from dalg24 and masterleinad May 3, 2025 16:53
template <typename Traits>
using AccessTraitsMemorySpaceArchetypeAlias = typename Traits::memory_space;
template <class T, class U>
concept not_same_as = !std::same_as<T, U>;
Copy link
Contributor Author

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.

@aprokop
Copy link
Contributor Author

aprokop commented May 16, 2025

@dalg24 Could you please take a look at this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API User visible interface modifications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant