4 ms·
I tried Rust a few weeks ago. Is my understanding correct that Rust doesn't have the equivalents to the following C++ features yet? - non-type and template tem
by leni536 8y ago
I tried Rust a few weeks ago. Is my understanding correct that Rust doesn't have the equivalents to the following C++ features yet?
- non-type and template template parameters
- constexpr functions
I understand that Rust macros can replace them some of the time, and they are much better then the C preprocessor, but that's quite a low bar to meet. Last time I checked non-type template parameters (called "const generics" in Rust) is on the roadmap, so it is promising.
- th0br0 8y agoA `const fn` RFC is accepted and somwhat available when using nightly compilers, also see https://github.com/rust-lang/rust/issues/24111 https://github.com/rust-lang/rust/issues/24111
- steveklabnik 8y agoThe equivalent of "constexpr functions" has a design, and is usable in nightly. The equivalent of "non-type template parameters" has a design, but is not yet implemented. It's being worked on. There's no direct design for the equivalent of "template template parameters", but a similar feature has a design, but is not yet implemented. It's being worked on.