
20 May
2008
20 May
'08
4:33 p.m.
John Moeller <fishcorn <at> gmail.com> writes:
Note also, please, that positive_power<0,false> returns 1 when base is 0. Since 0^0 is technically undefined, the "N=0" case should probably be handled at a higher level (in power_if_positive, perhaps), and cause an error, just like negative powers of 0. If that is done, the 0/false case could be removed from positive_power.
Actually, a rationale could be provided for pow<0>(0) == 1. But it should be explained in the documentation. Alternatively, you could use a policy class, I suppose. Either way, pow<0> should probably be handled as a special case, not in positive_power.