: Consider simplifying is_function (original) (raw)
is_function is currently implemented with a zillion partial specializations. This allows us to inspect the result and argument types (needed for deprecated/removed machinery), but is costly for finding the true/false answer. A simpler approach, explained by Walter Brown at CppCon 2019, is to take advantage of the fact that const T isn't const for function types and reference types (and detecting reference types is easy).
This doesn't actually matter for MSVC's compiler front-end due to how it optimizes well-known type trait structs and variable templates (is_function is one of them). However, it matters for Clang/LLVM (which does not have such an optimization to my knowledge) and general code clarity.