#pragma once #include #include namespace DB { template static bool castTypeToEither(const T * type, F && f) { /// XXX can't use && here because gcc-7 complains about parentheses around && within || return ((typeid_cast(type) ? f(*typeid_cast(type)) : false) || ...); } template constexpr bool castTypeToEither(TypeList, const auto * type, auto && f) { return ( (typeid_cast(type) != nullptr ? std::forward(f)( *typeid_cast(type)) : false) || ...); } }