3 ms·
It's using the type system to encode an arithmetic expression, with unique types for every distinct subtree; and then using statically-dispatched calls to inlin
by barrkel 17y ago
It's using the type system to encode an arithmetic expression, with unique types for every distinct subtree; and then using statically-dispatched calls to inlined methods to get the compiler to embed the tree in-place, so that the optimizer's constant folding can evaluate the tree. The amount of code and data that's being shifted around and manipulated inside the compiler to generate a rather trivial end effect is what's offensive to me. If C++ were slightly more expressive, the technique would be unnecessary; but some C++ acolytes actually extol these kinds of techniques as a feature!
- jheriko 17y agoThe technique is unnecessary, regardless as to C++ - its just a different way to write code.