1 | #pragma once |
---|---|
2 | |
3 | #include <Common/typeid_cast.h> |
4 | |
5 | namespace DB |
6 | { |
7 | |
8 | class IDataType; |
9 | |
10 | template <typename... Ts, typename F> |
11 | static bool castTypeToEither(const IDataType * type, F && f) |
12 | { |
13 | /// XXX can't use && here because gcc-7 complains about parentheses around && within || |
14 | return ((typeid_cast<const Ts *>(type) ? f(*typeid_cast<const Ts *>(type)) : false) || ...); |
15 | } |
16 | |
17 | } |
18 |