Skip to content
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

Ensure that Lazy functions are called with a callable argument. #16267

Merged
merged 1 commit into from Nov 15, 2023

Conversation

bangerth
Copy link
Member

Follow-up to #16182 .

@@ -136,7 +138,8 @@ class Lazy
*/
template <typename Callable>
void
ensure_initialized(const Callable &creator) const;
ensure_initialized(const Callable &creator) const
DEAL_II_CXX20_REQUIRES((std::is_invocable_r_v<T, Callable>));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will note that there is a std::invocable concept: https://en.cppreference.com/w/cpp/concepts/invocable The problem is that there is no concept like std::invocable_r that also checks the return type. One could do this with std::invoke_result (https://en.cppreference.com/w/cpp/types/result_of), but that's no simpler than this here. In the end, the thing in a requires clause just has to be a boolean expression. It doesn't have to be a concept.

@tamiko tamiko merged commit d9ba83f into dealii:master Nov 15, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants