Boost logo

Boost :

Subject: Re: [boost] [ratio][mpl] static metafunctions
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-12-31 11:06:53


----- Original Message -----
From: "vicente.botet" <vicente.botet_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, December 31, 2010 10:13 AM
Subject: Re: [boost] [ratio][mpl] static metafunctions

> ----- Original Message -----
> From: "Aleksey Gurtovoy" <agurtovoy_at_[hidden]>
> To: <boost_at_[hidden]>
> Sent: Friday, December 31, 2010 7:06 AM
> Subject: Re: [boost] [ratio][mpl] static metafunctions
>
>
>> On Thu, 30 Dec 2010 15:52:58 -0600, Dave Abrahams <dave_at_[hidden]>
>> wrote:
>>
>>> At Thu, 30 Dec 2010 22:45:12 +0100,
>>> vicente.botet wrote:
>>>>
>>>> Hi,
>>>>
>>>> during the Boost.Ratio review as requested to push some of the static
>>>> integer metafunctions as static_abs, static_sign, static_gcd,
>>>> static_lcm to a public library.
>>>>
>>>> At the begining I has the impression that these functions should be
>>>> added to Boost.Integer or Boost.Math, but after reflexion I think that
>>>> these static metafunctions could be better integrated into Boost.MPL
>>>> with the existing integral functions. I have prepared a patch for 3 of
>>>> them.
>>>>
>>>> Do you think that these can be added to Boost.MPL if I provide the
>>>> needed documentation and tests?
>>>>
>>>
>>> Looks good to me. Aleksey?
>>
>> I'd drop BOOST_MPL_CFG_MSVC_ETI_BUG workarounds since they are only
>> relevant for MSVC < 7.1, otherwise yes, I will be happy to accept this
>> (with tests and docs :).
>
> OK. I will remove this part.
>
> Otherwise, I needed to add a new BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2 because with BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC I got an compile error with MSVC.10 when passing the nested value to the template. As I have no tested it with other versions of MSVC I have just supposed that this doesn't works neither on older versions. I didn't change the exixting macro to make evident the difference.
>
> +#if !defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) \
> + && !defined(BOOST_MPL_PREPROCESSING_MODE) \
> + && ( defined(BOOST_MSVC) \
> + || BOOST_WORKAROUND(__EDG_VERSION__, <= 238) \
> + )
> +
> +# define BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2
> +
> +#endif
>
> I will try to send the complete patch soon.

Hi again,

I have added the lcm.hpp file, the doc and some tests. I have changed the implementation of gcd and lcm to return always a positive number, even if a signed result could also be acceptable (I have choosen this option as the Boost.Math lib behaves this way).

I have no mean to generate the doc currently, so in addition to check the contents, could some of you try to integrate them and see the resulting documentation?

I want to add some more tests combining different signed and unsigned types, but I will do it next year.

BTW, have a happy end of year!
Vicente





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