|
Boost : |
From: Matthias Schabel (boost_at_[hidden])
Date: 2007-05-04 16:20:35
I briefly thought about trying to put together a patch, but, after
looking at the code for mpl/multiplies.hpp, I quickly decided that it
was way more of a can of worms than I feel comfortable opening. I
imagine that it would be relatively simple to do for someone with
familiarity with the internals of MPL, but that isn't me... root<>
also raises some issues since it only makes sense (on integers) for
roots of integers that are themselves integral. This is obviously not
a problem for rational roots...
Matthias
> 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
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/
> listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk