diff --git a/src/Common/FieldVisitors.h b/src/Common/FieldVisitors.h index c45869c3746..d4b3b187ca4 100644 --- a/src/Common/FieldVisitors.h +++ b/src/Common/FieldVisitors.h @@ -40,21 +40,24 @@ struct StaticVisitor template auto applyVisitor(Visitor && visitor, F && field) { - return Field::dispatch(visitor, field); + return Field::dispatch(std::forward(visitor), + std::forward(field)); } template auto applyVisitor(Visitor && visitor, F1 && field1, F2 && field2) { - return Field::dispatch([&](auto & field1_value) + return Field::dispatch( + [&field2, &visitor](auto & field1_value) { - return Field::dispatch([&](auto & field2_value) + return Field::dispatch( + [&field1_value, &visitor](auto & field2_value) { return visitor(field1_value, field2_value); }, - field2); + std::forward(field2)); }, - field1); + std::forward(field1)); }