News for hackers. Stuff that matters.
Re:Rust 1.51 by reader_mode on Thursday March 25, 2021 @12:37PM (#26582365)
The good old Vector<T, N> from C++.

For all the pain points C++ has, template metaprogramming was always so satisfying when you got it to work. Satisfying in "I feel really clever for solving this so generally and with no runtime overhead" way, but also being completely aware that another person reading the code and having to maintain it migh order a hit on me over darkweb.

Re:Rust 1.51 by nayuki on Thursday March 25, 2021 @01:12PM (#26582787)
Do you mean std::array<T,N>? ( https://en.cppreference.com/w/cpp/container/array )
Re:Rust 1.51 by reader_mode on Thursday March 25, 2021 @02:17PM (#26583549)
Vector<T, N> an Matrix<T, N> is a fancy way to do small linear algebra types - like 2,3,4 vector and 3x3/4x4 matrix - you implement simple operations like add, multiply and dot products with loops and the compiler will unroll it and then you add some specific overloads for stuff like cross product, etc. Saves you having to reimplement it for every N. It's the simplest case of this kind of metaprogramming and feels good once you discover this kind of generalisation.