1#pragma once
2
3#include <Common/typeid_cast.h>
4
5namespace DB
6{
7
8class IDataType;
9
10template <typename... Ts, typename F>
11static 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