-
Notifications
You must be signed in to change notification settings - Fork 407
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
Detect mismatch of execution spaces in functors #4655
Detect mismatch of execution spaces in functors #4655
Conversation
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 was in a process of converting my initial solution, similar to this, into a runtime check in attempt to make an unit-test, but I think compile-time check is sufficient, given that it is a fairly simple check.
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 would prefer if you used is_detected<execution_space_t, Policy>::value
instead of std::is_same<detected_t<execution_space_t, Policy>, nonesuch>::value
@dalg24 I addressed your suggestions. In my opinion, the changes here would be a good example of why defining |
Fair enough. I still don't like the idea of writing using FunctorExecutionSpace = detected_or<MyDefault, execution_space_t, Functor>;
static_assert(!typename FunctorExecutionSpace::value_type::value || ...);
// or
static_assert(!std::is_same<MyDefault, typename FunctorExecutionSpace::type>::value || ...); |
Fixes #2074.