Boost logo

Boost :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-02-05 12:30:43


AMDG

John Maddock wrote:
> I'm a bit concerned about this interface: my guess is that 90% or more of
> users would just want integer exponents, and these should be very easy to
> use, preferably simply:
>
> pow<2>(val)
>
> Hmmm, I wonder if we can define an overload such that:
>
> pow<2,3>(val)
>
> is also valid?
>
> Regards, John.
>

Ok. How about:

template<class N, class T>
... pow(T t);

template<int N, class T>
... pow(T t) {
    return(pow<mpl::int_<N> >(t));
}

In Christ,
Steven Watanabe


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