3 ms·
This is one of my big frustration with Rust and probably the only feature from C++ I rally missed (C++ templates having "non-type parameters"). I'm very happy t
by simias 6y ago
This is one of my big frustration with Rust and probably the only feature from C++ I rally missed (C++ templates having "non-type parameters"). I'm very happy to soon see it lifted.
There were workarounds for some common scenarios already, but it's just so much more simple and convenient to be able to write `fn foo<const N: u32>()`.
I'll finally be able to simplify a significant portion of my code.
- tspiteri 6y agoLucky you :) In my case the only thing I could to do was to change the README of my crate from saying that I plan to migrate from typenum to const generics "when they are supported by the Rust compiler" to now saying "when the Rust compiler support for them is powerful enough". (I need constraints on which ranges are allowed, and that is a little hairier than the MVP; though typenum is perfectly adequate.)