quote:
Just out of curiosity (I'm not that experienced with the details of templates), how fast would your ColorTraits approach perform compared to other approaches? And what does it convert to? Does it do an if statement under the hood or a table lookup or a function pointer, or what? Like I said, I'm not all that familiar with how the compiler translates these kind of templated things.
Templates are evaluated in compile time, which means that there is no overhead whatsoever. The effect is that now I can call the functions passed_pawns<White>() and passed_pawns<Black>(), they would do the right thing, they are as efficient as if they had been coded separately, but I only had to write one function.
[edited by - Alvaro on October 14, 2003 9:02:01 PM]