18template<
typename T,
class C =
void>
24 requires std::assignable_from<T&, T>
35 SetOnce(T initial = T()) :
37 mDefaultValue(initial),
43 bool isSet()
const {
return mSet; }
44 const T& value()
const {
return mValue; }
49 mValue = mDefaultValue;
52 SetOnce<T, void>& operator=(
const T& value)
64 const T& operator*()
const {
return mValue; }
65 const T* operator->()
const {
return &mValue; }
66 explicit operator bool()
const {
return mSet; }
70template<
typename T,
class C>
71 requires std::assignable_from<T&, T> && comparator<C, T>
86 mDefaultValue(initial),
92 bool isSet()
const {
return mSet; }
93 const T&
value()
const {
return mValue; }
98 mValue = mDefaultValue;
103 if(!mSet && !mComparator(mDefaultValue, value))
115 explicit operator bool()
const {
return mSet; }
SetOnce< T, C > & operator=(const T &value)
Definition qx-setonce.h:101
bool isSet() const
Definition qx-setonce.h:92
const T & value() const
Definition qx-setonce.h:93
SetOnce(T initial, C &&comp=C())
Definition qx-setonce.h:83
const T & operator*() const
Definition qx-setonce.h:113
const T * operator->() const
Definition qx-setonce.h:114
void reset()
Definition qx-setonce.h:95
The Qx namespace is the main namespace through which all non-global functionality of the Qx library i...
Definition qx-abstracterror.cpp:13
QTextStream & reset(QTextStream &stream)
The qx-concepts header file provides a library of general purpose concepts as an extension of the sta...