Skip to content

Commit eeab9cf

Browse files
committed
lazy<> const fix
1 parent 2dfe7ff commit eeab9cf

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

kit/reactive/reactive.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ namespace kit
112112
m_Value = value;
113113
}
114114

115-
void pend() {
115+
void pend() const {
116116
m_Value = boost::optional<T>();
117117
}
118118

119-
void recache() {
119+
void recache() const {
120120
m_Value = m_Getter();
121121
}
122122

123-
void ensure() {
123+
void ensure() const {
124124
if(!m_Value)
125125
m_Value = m_Getter();
126126
}
@@ -129,10 +129,10 @@ namespace kit
129129
return bool(m_Value);
130130
}
131131

132-
boost::optional<T> try_get() {
132+
boost::optional<T> try_get() const {
133133
return m_Value;
134134
}
135-
T& get() {
135+
T& get() const {
136136
ensure();
137137
return *m_Value;
138138
}
@@ -146,12 +146,12 @@ namespace kit
146146
m_Getter = func;
147147
}
148148

149-
T& operator()() {
149+
T& operator()() const {
150150
return get();
151151
}
152152

153153
private:
154-
boost::optional<T> m_Value;
154+
mutable boost::optional<T> m_Value;
155155
std::function<T()> m_Getter;
156156
};
157157

0 commit comments

Comments
 (0)