Forgot your password?
typodupeerror

Comment Re:What could possibly go wrong? (Score 1) 272

You can also specialize C code for architectures, you do not need C++ template metaprograms for this.

Of course, but you end up with code that is a lot more verbose and with more room for errors.

Anyway, a much more interesting particular example imho is using templates for lazy operator evaluation in matrix algebra. It lets you do automatically some loop combining that is absolutely visible speed-wise compared to a normal order-of-operations approach - the fun "oh, C++ can be faster than Fortran at matrix algebra??" surprise. Yeah, you can hand-code something like that in C every time you add some matrices, but ... well, see my previous point. Now if you take this particular example and extend it to general composable operations in arbitrary libraries, you'll see that in fact C++ can be faster than plain C under similar development resource constraints, if you know how to take advantage of the things the compiler will do for you.

Slashdot Top Deals

I never cheated an honest man, only rascals. They wanted something for nothing. I gave them nothing for something. -- Joseph "Yellow Kid" Weil

Working...