Hacker News new | ask | show | jobs
by GuB-42 1117 days ago
I don't think Rust has an equivalent to C++17 constexpr, it is more limited.

Zig may be a better option when it comes to compile-time evaluation.

1 comments

The `if` part of the quoted example, you can do in Rust; the `else` part is coming with the specialization feature soon. Everything you can't do with traits, including specialization, you should probably not be doing; modern C++ tends to be an incomprehensible template forest.