Skip to content

"if constexpr" and compile-time reflection making meta-programming without macros #68898

@Xtricman

Description

@Xtricman

C++ has "if constexpr" to enable conditional compilation, with the type_traits functions, so it can generate code based on properties of a type using normal C++ grammar instead of writing macros, but type_traits are very tricky to implement (usually involving SFINAE or even intrinsics) because C++ currently doesn't have compile-time reflection, SFINAE can't inspect fields of a type.

Rust already support compile time evaluation, can we add "if constexpr" and compile-time reflection to Rust so meta-programing would be much easier using normal Rust grammar?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions