revert change of F&& to const F&

This commit is contained in:
stu
2024-03-21 12:11:06 +00:00
parent 58d89e717c
commit 3cfee3f62d
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -199,7 +199,7 @@ class NamedTuple {
/// Invokes a callable object once for each field in order.
template <typename F>
void apply(const F& _f) {
void apply(F&& _f) {
const auto apply_to_field =
[&_f]<typename... AFields>(AFields&&... fields) {
((_f(std::forward<AFields>(fields))), ...);
@@ -209,7 +209,7 @@ class NamedTuple {
/// Invokes a callable object once for each field in order.
template <typename F>
void apply(const F& _f) const {
void apply(F&& _f) const {
const auto apply_to_field = [&_f](const auto&... fields) {
((_f(fields)), ...);
};
+1 -1
View File
@@ -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";
}