mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #12341 from ClickHouse/aku/perfect-visitor
More perfect forwarding in field visitors
This commit is contained in:
commit
10b0287fa4
@ -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(
|
||||
[&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