20 #ifndef KERNEL_UTILITIES_LAZYEVALUATE_H 21 #define KERNEL_UTILITIES_LAZYEVALUATE_H 23 #include "pedigree/kernel/compiler.h" 24 #include "pedigree/kernel/utilities/utility.h" 39 template <
class T,
class M, T *(*create)(const M &),
void (*destroy)(T *)>
44 LazyEvaluate() : m_Metadata(), m_Field(
nullptr), m_Ok(
false)
49 : m_Metadata(metadata), m_Field(
nullptr), m_Ok(
true)
53 : m_Metadata(pedigree_std::move(metadata)), m_Field(
nullptr), m_Ok(
true)
57 LazyEvaluate(T *value) : m_Metadata(), m_Field(value), m_Ok(
true)
61 : m_Metadata(metadata), m_Field(value), m_Ok(
true)
65 : m_Metadata(pedigree_std::move(metadata)), m_Field(value), m_Ok(
true)
75 return m_Ok && (m_Field !=
nullptr);
95 m_Field = create(m_Metadata);
111 operator bool()
const 130 #endif // KERNEL_UTILITIES_LAZYEVALUATE_H