Skip to content

Commit 702e6da

Browse files
fix: allows usage of stateful visitors inside rfl::Variant
1 parent 3e55b8d commit 702e6da

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

include/rfl/Variant.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class Variant {
223223
template <class F, IndexType... _is>
224224
void do_visit_no_result(F& _f, bool* _visited,
225225
std::integer_sequence<IndexType, _is...>) {
226-
auto visit_one = [this]<IndexType _i>(const F& _f, bool* _visited,
226+
auto visit_one = [this]<IndexType _i>(F& _f, bool* _visited,
227227
Index<_i>) {
228228
if (!*_visited && index_ == _i) {
229229
_f(get_alternative<_i>());
@@ -236,7 +236,7 @@ class Variant {
236236
template <class F, IndexType... _is>
237237
void do_visit_no_result(F& _f, bool* _visited,
238238
std::integer_sequence<IndexType, _is...>) const {
239-
auto visit_one = [this]<IndexType _i>(const F& _f, bool* _visited,
239+
auto visit_one = [this]<IndexType _i>(F& _f, bool* _visited,
240240
Index<_i>) {
241241
if (!*_visited && index_ == _i) {
242242
_f(get_alternative<_i>());
@@ -275,7 +275,7 @@ class Variant {
275275
template <class F, class ResultType, IndexType... _is>
276276
void do_visit_with_result(F& _f, std::optional<ResultType>* _result,
277277
std::integer_sequence<IndexType, _is...>) {
278-
auto visit_one = [this]<IndexType _i>(const F& _f,
278+
auto visit_one = [this]<IndexType _i>(F& _f,
279279
std::optional<ResultType>* _result,
280280
Index<_i>) {
281281
if (!*_result && index_ == _i) {
@@ -288,7 +288,7 @@ class Variant {
288288
template <class F, class ResultType, IndexType... _is>
289289
void do_visit_with_result(F& _f, std::optional<ResultType>* _result,
290290
std::integer_sequence<IndexType, _is...>) const {
291-
auto visit_one = [this]<IndexType _i>(const F& _f,
291+
auto visit_one = [this]<IndexType _i>(F& _f,
292292
std::optional<ResultType>* _result,
293293
Index<_i>) {
294294
if (!*_result && index_ == _i) {
@@ -328,7 +328,7 @@ class Variant {
328328
void do_visit_with_reference(F& _f, ResultType** _result,
329329
std::integer_sequence<IndexType, _is...>) {
330330
const auto visit_one = [this]<IndexType _i>(
331-
const F& _f, ResultType** _result, Index<_i>) {
331+
F& _f, ResultType** _result, Index<_i>) {
332332
if (!*_result && index_ == _i) {
333333
*_result = &_f(get_alternative<_i>());
334334
}
@@ -340,7 +340,7 @@ class Variant {
340340
void do_visit_with_reference(F& _f, ResultType** _result,
341341
std::integer_sequence<IndexType, _is...>) const {
342342
const auto visit_one = [this]<IndexType _i>(
343-
const F& _f, ResultType** _result, Index<_i>) {
343+
F& _f, ResultType** _result, Index<_i>) {
344344
if (!*_result && index_ == _i) {
345345
*_result = &_f(get_alternative<_i>());
346346
}

0 commit comments

Comments
 (0)