Skip to content

<type_traits>: Consider simplifying is_function #198

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixedSomething works now, yay!throughputMust compile faster

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions