35 fValue = std::move(that.fValue);
45 template <
typename... Args>
T*
init(Args&&...
args) {
46 fValue.emplace(std::forward<Args>(
args)...);
62 fValue = std::move(
src);
77 bool isValid()
const {
return fValue.has_value(); }
85 return &fValue.value();
89 return &fValue.value();
112 std::optional<T> fValue;
153 fObj = fLazy.has_value() ? &fLazy.value() : that.fObj;
158 fLazy = std::move(that.fLazy);
159 fObj = fLazy.has_value() ? &fLazy.value() : that.fObj;
171 template <
typename... Args>
175 fObj = &fLazy.emplace(std::forward<Args>(
args)...);
184 if (!fLazy.has_value()) {
186 fObj = &fLazy.value();
188 return &fLazy.value();
191 const T*
get()
const {
return fObj; }
199 operator const T*()
const {
return fObj; }
205 std::optional<T> fLazy;
SkTCopyOnFirstWrite & operator=(SkTCopyOnFirstWrite &&that)
void initIfNeeded(Args &&... args)
SkTCopyOnFirstWrite & operator=(const SkTCopyOnFirstWrite &that)
SkTCopyOnFirstWrite(const SkTCopyOnFirstWrite &that)
const T * operator->() const
SkTCopyOnFirstWrite(SkTCopyOnFirstWrite &&that)
SkTCopyOnFirstWrite(const T *initial)
const T & operator*() const
SkTCopyOnFirstWrite(const T &initial)
void init(const T &initial)
const T * operator->() const
T * init(Args &&... args)
SkTLazy(const SkTLazy &that)
const T & operator*() const
SkTLazy & operator=(const SkTLazy &that)
SkTLazy & operator=(SkTLazy &&that)
const T * getMaybeNull() const
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args