Boost logo

Boost :

From: John Moeller (fishcorn_at_[hidden])
Date: 2008-05-20 12:33:06


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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk