* Lazy<FullMatrix<double>> prolongation_matrix;
* };
* ```
+ *
+ * @dealiiConceptRequires{std::is_constructible_v<T, T> &&
+ std::is_assignable_v<T &, T &&>}
*/
template <typename T>
+DEAL_II_CXX20_REQUIRES((std::is_constructible_v<T, T> &&
+ std::is_assignable_v<T &, T &&>))
class Lazy
{
public:
template <typename T>
+DEAL_II_CXX20_REQUIRES((std::is_constructible_v<T, T> &&
+ std::is_assignable_v<T &, T &&>))
inline Lazy<T>::Lazy()
: object_is_initialized(false)
{}
template <typename T>
+DEAL_II_CXX20_REQUIRES((std::is_constructible_v<T, T> &&
+ std::is_assignable_v<T &, T &&>))
inline Lazy<T>::Lazy(const Lazy &other)
: object(other.object)
{
template <typename T>
+DEAL_II_CXX20_REQUIRES((std::is_constructible_v<T, T> &&
+ std::is_assignable_v<T &, T &&>))
inline Lazy<T>::Lazy(Lazy &&other) noexcept
: object(other.object)
{
template <typename T>
-inline Lazy<T> &
-Lazy<T>::operator=(const Lazy &other)
+DEAL_II_CXX20_REQUIRES((std::is_constructible_v<T, T> &&
+ std::is_assignable_v<T &, T &&>))
+inline Lazy<T> &Lazy<T>::operator=(const Lazy &other)
{
object = other.object;
object_is_initialized.store(other.object_is_initialized.load());
template <typename T>
-inline Lazy<T> &
-Lazy<T>::operator=(Lazy &&other) noexcept
+DEAL_II_CXX20_REQUIRES((std::is_constructible_v<T, T> &&
+ std::is_assignable_v<T &, T &&>))
+inline Lazy<T> &Lazy<T>::operator=(Lazy &&other) noexcept
{
object = other.object;
object_is_initialized.store(other.object_is_initialized.load());
template <typename T>
-inline void
-Lazy<T>::reset() noexcept
+DEAL_II_CXX20_REQUIRES((std::is_constructible_v<T, T> &&
+ std::is_assignable_v<T &, T &&>))
+inline void Lazy<T>::reset() noexcept
{
object_is_initialized.store(false);
object.reset();
template <typename T>
+DEAL_II_CXX20_REQUIRES((std::is_constructible_v<T, T> &&
+ std::is_assignable_v<T &, T &&>))
template <typename Callable>
-inline DEAL_II_ALWAYS_INLINE void
-Lazy<T>::ensure_initialized(const Callable &creator) const
+inline DEAL_II_ALWAYS_INLINE
+ void Lazy<T>::ensure_initialized(const Callable &creator) const
DEAL_II_CXX20_REQUIRES((std::is_invocable_r_v<T, Callable>))
{
//
template <typename T>
-inline DEAL_II_ALWAYS_INLINE bool
-Lazy<T>::has_value() const
+DEAL_II_CXX20_REQUIRES((std::is_constructible_v<T, T> &&
+ std::is_assignable_v<T &, T &&>))
+inline DEAL_II_ALWAYS_INLINE bool Lazy<T>::has_value() const
{
//
// In principle it would be sufficient to solely check the atomic<bool>
template <typename T>
-inline DEAL_II_ALWAYS_INLINE const T &
-Lazy<T>::value() const
+DEAL_II_CXX20_REQUIRES((std::is_constructible_v<T, T> &&
+ std::is_assignable_v<T &, T &&>))
+inline DEAL_II_ALWAYS_INLINE const T &Lazy<T>::value() const
{
Assert(
object_is_initialized && object.has_value(),
template <typename T>
-inline DEAL_II_ALWAYS_INLINE T &
-Lazy<T>::value()
+DEAL_II_CXX20_REQUIRES((std::is_constructible_v<T, T> &&
+ std::is_assignable_v<T &, T &&>))
+inline DEAL_II_ALWAYS_INLINE T &Lazy<T>::value()
{
Assert(
object_is_initialized && object.has_value(),
template <typename T>
+DEAL_II_CXX20_REQUIRES((std::is_constructible_v<T, T> &&
+ std::is_assignable_v<T &, T &&>))
template <typename Callable>
-inline DEAL_II_ALWAYS_INLINE const T &
-Lazy<T>::value_or_initialize(const Callable &creator) const
+inline DEAL_II_ALWAYS_INLINE const T &Lazy<T>::value_or_initialize(
+ const Callable &creator) const
DEAL_II_CXX20_REQUIRES((std::is_invocable_r_v<T, Callable>))
{
ensure_initialized(creator);
template <typename T>
+DEAL_II_CXX20_REQUIRES((std::is_constructible_v<T, T> &&
+ std::is_assignable_v<T &, T &&>))
template <typename Callable>
-inline DEAL_II_ALWAYS_INLINE T &
-Lazy<T>::value_or_initialize(const Callable &creator)
+inline DEAL_II_ALWAYS_INLINE T &Lazy<T>::value_or_initialize(
+ const Callable &creator)
DEAL_II_CXX20_REQUIRES((std::is_invocable_r_v<T, Callable>))
{
ensure_initialized(creator);
template <typename T>
-std::size_t
-Lazy<T>::memory_consumption() const
+DEAL_II_CXX20_REQUIRES((std::is_constructible_v<T, T> &&
+ std::is_assignable_v<T &, T &&>))
+std::size_t Lazy<T>::memory_consumption() const
{
return MemoryConsumption::memory_consumption(object) + //
sizeof(*this) - sizeof(object);