Boost logo

Boost :

From: Kevin Sopp (baraclese_at_[hidden])
Date: 2007-05-04 06:50:00


Hi,
to bring this up I believe this is kinda useful. I had to write my own
power<> and root<> recently and wondered the excact same thing. Have
you written these templates? Maybe you could submit a patch, my
version does not use the MPL, I just rely on the good compile time
evaluation of constant expressions by gcc.

Kevin

On 4/21/07, Matthias Schabel <boost_at_[hidden]> wrote:
> It would be nice if we could represent all compile-time algebraic
> operations in Boost.Units using MPL arithmetic. At present, MPL
> supports negate, adds, subtracts, times, divides. Boost.Units
> additionally would require :
>
> 1) unary_plus - the compile-time equivalent of operator+(T)
> 2) unary_minus - the compile-time equivalent of operator-(T); this is
> identical to current mpl::negate, but it would be nice to have it for
> notational consistency with unary_plus
> 3) power<T,U> (or pow<T,U>) - the compile-time equivalent of pow(T,U)
> 4) root<T,U> - the compile-time equivalent of pow(T,1/U); can be
> implemented with power<T,U>, but this is a nicer syntax
>
> to eliminate its remaining compile-time algebra operators. Any
> thoughts on whether this would be a worthwhile addition to MPL?
>
> Matthias


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