
17 May
2008
17 May
'08
2:35 a.m.
On May 15, 2008, at 10:40 AM, John Moeller wrote:
Fair enough. I think, though, if you're going to try to make sure that the compiler doesn't miss multiplication by 1, you may as well go all the way and add another template parameter to capture N%2, and get rid of the ternary statement:
To be clear, I'm not concerned about optimizing multiplication by 1 for builtin types, of course. But it seems to me that the compiler shouldn't really be able to optimize for user-defined types (what if multiplication isn't inlined, for instance...) -- Hervé Brönnimann hervebronnimann@mac.com