mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
More perfect forwarding in field visitors
This commit is contained in:
parent
8095a4e2bb
commit
0001a08081
@ -40,21 +40,24 @@ struct StaticVisitor
|
||||
template <typename Visitor, typename F>
|
||||
auto applyVisitor(Visitor && visitor, F && field)
|
||||
{
|
||||
return Field::dispatch(visitor, field);
|
||||
return Field::dispatch(std::forward<Visitor>(visitor),
|
||||
std::forward<F>(field));
|
||||
}
|
||||
|
||||
template <typename Visitor, typename F1, typename F2>
|
||||
auto applyVisitor(Visitor && visitor, F1 && field1, F2 && field2)
|
||||
{
|
||||
return Field::dispatch([&](auto & field1_value)
|
||||
return Field::dispatch(
|
||||
[&field1, &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<F2>(field2));
|
||||
},
|
||||
field1);
|
||||
std::forward<F1>(field1));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user