c++ - Is there something like expression templates in Rust? -


in c++, expression templates technique relies on compiler's knowledge expressions in c++ code simplify them , optimize them beyond possible in procedural program. it's powerful technique used e.g. eigen , armadillo matrix libraries speed compound operations on matrices. incomplete wiki page on eigen web page starts explaining it.

i wonder if similar technique exists in rust, i.e. there way make rust compiler optimize expressions @ compile time least amount of temporaries created.

if read expression templates right, can see them in action rust iterators: methods such filter, take, etc etc return expression template, struct represents computation doesn't perform until requested. gives optimization require right away, no temporaries created.

using where clause imagine 1 can write specializations further optimize combinations of computations.


Comments