4 ms·
Most of the language probably isn't too far from C to be done, but I can't even guess at what would have to be done for C++'s templates.
by simcop2387 7y ago
Most of the language probably isn't too far from C to be done, but I can't even guess at what would have to be done for C++'s templates.
- zozbot234 7y agoThe closest Rusty feature to C++ templates is most likely macros. I don't think even const generics, specialization etc. (which are WIP anyway at the moment) would be enough to replicate templates in the fully general case.
- heavenlyblue 7y agoI most surely misunderstand something: why are templates not replaceable with Rust generics?
- mathw 7y agoThe simple answer is that C++ templates can do more than Rust generics can, including some things that in Rust you'd use the macro system for, and probably some things that you'd have to translate by expanding out the template and turning that result into Rust.