From: Wolfgang Bangerth Date: Tue, 14 Nov 2023 00:23:02 +0000 (-0700) Subject: Ensure that Lazy functions are called with a callable argument. X-Git-Tag: relicensing~296^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0f9aea8f95c6afef2205516caeaf3fa7547379e;p=dealii.git Ensure that Lazy functions are called with a callable argument. --- diff --git a/include/deal.II/base/lazy.h b/include/deal.II/base/lazy.h index 450230cd0a..2375e86813 100644 --- a/include/deal.II/base/lazy.h +++ b/include/deal.II/base/lazy.h @@ -26,6 +26,8 @@ #include #include #include +#include + DEAL_II_NAMESPACE_OPEN @@ -136,7 +138,8 @@ public: */ template void - ensure_initialized(const Callable &creator) const; + ensure_initialized(const Callable &creator) const + DEAL_II_CXX20_REQUIRES((std::is_invocable_r_v)); /** @@ -184,7 +187,8 @@ public: */ template const T & - value_or_initialize(const Callable &creator) const; + value_or_initialize(const Callable &creator) const + DEAL_II_CXX20_REQUIRES((std::is_invocable_r_v)); /** @@ -192,7 +196,8 @@ public: */ template DEAL_II_ALWAYS_INLINE inline T & - value_or_initialize(const Callable &creator); + value_or_initialize(const Callable &creator) + DEAL_II_CXX20_REQUIRES((std::is_invocable_r_v)); /** @@ -284,6 +289,7 @@ template template inline DEAL_II_ALWAYS_INLINE void Lazy::ensure_initialized(const Callable &creator) const + DEAL_II_CXX20_REQUIRES((std::is_invocable_r_v)) { // // Use Schmidt's double checking [1] for checking and initializing the @@ -387,6 +393,7 @@ template template inline DEAL_II_ALWAYS_INLINE const T & Lazy::value_or_initialize(const Callable &creator) const + DEAL_II_CXX20_REQUIRES((std::is_invocable_r_v)) { ensure_initialized(creator); return object.value(); @@ -397,6 +404,7 @@ template template inline DEAL_II_ALWAYS_INLINE T & Lazy::value_or_initialize(const Callable &creator) + DEAL_II_CXX20_REQUIRES((std::is_invocable_r_v)) { ensure_initialized(creator); return object.value();