3 ms·
I think the most powerful feature of C++ is templating. Templating makes it very easy to write high-performance math code (no dynamic function calls, everything
by __mp 10y ago
I think the most powerful feature of C++ is templating. Templating makes it very easy to write high-performance math code (no dynamic function calls, everything unrolled by the compiler...).
Just have a look at the state of the art math libraries in rust and compare it to something like Eigen or Cgal. The C++ code is way more flexible and expressive than the rust code. If you don't believe me, check how the rust libraries handle matrix implementations. Often you will find specialized implementations of 1x1 to 4x4 matrices but no generic n-dimensional matrix code.
- santaclaus 10y agoExpression Templates are a big reason for Eigen's (and Blaze's) success compared to older linear algebra libraries -- I think something similar should be doable in Rust. Most commercial software packages (e.g. Maya) expose their APIs via C++, though, which makes the use of other languages trickier.
- steveklabnik 10y agoThis will get better once we have type level integers. It's just not there yet. You're totally right that it's a weak point st the moment.
- __mp 10y agoCool, I think rust needs some time to mature. I'm currently looking for a rust guide that shows me some programming patterns. For example: - How to best implement an observer pattern - Best practices for vector code - Best practices for tree implementations and how to implement a lambda on top of it. I'm interested in small snippets so that I can get some initial productive code and progress from there.
- steveklabnik 10y agoI agree that more docs on this kind of thing will be good, but I think going about it this way might be harder than you'd expect. Applying existing patterns and writing data structures is actually harder in Rust than in many other languages, and people that try to start with it often get stuck. Rust's own patterns and best practices are still kinda evolving, hence your maturity comment.