From 3cfee3f62ddf64f8066984d88a7e16113f29dbe2 Mon Sep 17 00:00:00 2001 From: stu Date: Thu, 21 Mar 2024 12:11:06 +0000 Subject: [PATCH] revert change of F&& to const F& --- include/rfl/NamedTuple.hpp | 4 ++-- tests/json/test_apply.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/rfl/NamedTuple.hpp b/include/rfl/NamedTuple.hpp index 1edd4d73..c2d38d73 100644 --- a/include/rfl/NamedTuple.hpp +++ b/include/rfl/NamedTuple.hpp @@ -199,7 +199,7 @@ class NamedTuple { /// Invokes a callable object once for each field in order. template - void apply(const F& _f) { + void apply(F&& _f) { const auto apply_to_field = [&_f](AFields&&... fields) { ((_f(std::forward(fields))), ...); @@ -209,7 +209,7 @@ class NamedTuple { /// Invokes a callable object once for each field in order. template - void apply(const F& _f) const { + void apply(F&& _f) const { const auto apply_to_field = [&_f](const auto&... fields) { ((_f(fields)), ...); }; diff --git a/tests/json/test_apply.cpp b/tests/json/test_apply.cpp index 3f80e843..bcb97db7 100644 --- a/tests/json/test_apply.cpp +++ b/tests/json/test_apply.cpp @@ -38,7 +38,7 @@ void test() { } }); - rfl::to_view(lisa).apply([](auto field) { + rfl::to_view(lisa).apply([](auto field) mutable { if constexpr (decltype(field)::name() == "first_name") { *field.value() = "Bart"; }