133 std::is_move_assignable_v<T>))
208 template <typename Callable>
210 ensure_initialized(const Callable &creator) const
249 template <typename Callable>
251 value_or_initialize(const Callable &creator) const
258 memory_consumption() const;
271 mutable
std::atomic<
bool> object_is_initialized;
285 std::is_move_assignable_v<T>))
287 : object_is_initialized(false)
294 std::is_move_assignable_v<T>))
301 object_is_initialized.store(
true);
302 task_result.emplace_object(other.
value());
305 object_is_initialized.store(
false);
312 std::is_move_assignable_v<T>))
326 std::is_move_assignable_v<T>))
333 object_is_initialized.store(
true);
334 task_result.emplace_object(other.
value());
338 object_is_initialized.store(
false);
349 std::is_move_assignable_v<T>))
365 std::is_move_assignable_v<T>))
368 object_is_initialized.store(
false);
375 std::is_move_assignable_v<T>))
376template <
typename Callable>
399 if (!object_is_initialized.load(std::memory_order_acquire))
400# ifdef DEAL_II_HAVE_CXX20
428 if (!object_is_initialized.load(std::memory_order_relaxed))
429 task_result.try_emplace_task(creator);
446 object_is_initialized.store(
true, std::memory_order_release);
450 ExcMessage(
"The current object does not contain a valid object "
451 "even though we have just initialized it."));
457 std::is_move_assignable_v<T>))
466 return (object_is_initialized && (task_result.empty() ==
false));
472 std::is_move_assignable_v<T>))
478 "value() has been called but the contained object has not been "
479 "initialized. Did you forget to call 'ensure_initialized()' first?"));
481 return task_result.value();
487 std::is_move_assignable_v<T>))
488template <
typename Callable>
490 const Callable &creator)
const
493 ensure_initialized(creator);
494 return task_result.value();
500 std::is_move_assignable_v<T>))
504 sizeof(*this) -
sizeof(task_result);
const T & value_or_initialize(const Callable &creator) const
void ensure_initialized(const Callable &creator) const
std::atomic< bool > object_is_initialized
std::size_t memory_consumption() const
Lazy & operator=(Lazy &&other) noexcept
Threads::TaskResult< T > task_result
Lazy(Lazy &&other) noexcept
Lazy & operator=(const Lazy &other)
#define DEAL_II_ALWAYS_INLINE
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_CXX20_REQUIRES(condition)
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)
std::enable_if_t< std::is_fundamental_v< T >, std::size_t > memory_consumption(const T &t)