[ratio][mpl] static metafunctions

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? Best regards, _____________________ Vicente Juan Botet Escribá http://viboes.blogspot.com/

At Thu, 30 Dec 2010 22:45:12 +0100, vicente.botet wrote:
[1 <text/plain; iso-8859-1 (quoted-printable)>] 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? -- Dave Abrahams BoostPro Computing http://www.boostpro.com

On Thu, 30 Dec 2010 15:52:58 -0600, Dave Abrahams <dave@boostpro.com> wrote:
At Thu, 30 Dec 2010 22:45:12 +0100, vicente.botet wrote:
[1 <text/plain; iso-8859-1 (quoted-printable)>] 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 :). -- Aleksey Gurtovoy MetaCommunications Engineering

----- Original Message ----- From: "Aleksey Gurtovoy" <agurtovoy@meta-comm.com> To: <boost@lists.boost.org> 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@boostpro.com> 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. Thanks, Vicente

----- Original Message ----- From: "vicente.botet" <vicente.botet@wanadoo.fr> To: <boost@lists.boost.org> Sent: Friday, December 31, 2010 10:13 AM Subject: Re: [boost] [ratio][mpl] static metafunctions
----- Original Message ----- From: "Aleksey Gurtovoy" <agurtovoy@meta-comm.com> To: <boost@lists.boost.org> 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@boostpro.com> 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

----- Original Message ----- From: "Aleksey Gurtovoy" <agurtovoy@meta-comm.com> To: <boost@lists.boost.org> 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@boostpro.com> wrote:
At Thu, 30 Dec 2010 22:45:12 +0100, vicente.botet wrote:
[1 <text/plain; iso-8859-1 (quoted-printable)>] 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 :).
I have added the modified files on https://svn.boost.org/svn/boost/sandbox/chrono/boost/mpl/ and https://svn.boost.org/svn/boost/sandbox/chrono/libs/mpl/ I've found useful to add the associated _c meta-functions, so we can request for gcd_c<int, 10, 6, 4> instead of gcd<int_<10>,int_<6>, int_<4>>. Let me know if you agree with this addition and if it is good to add them in the same file. For the moment I have documented variadic metafunctions for gcd and lcm, but I have not yet take the time to understand how the variadic part is done for other arithmetic operations and if I can use it. I'm sure some of the maintainers could make the needed modifications quite quikly. If this is not the case I will change the documentation until I get the variadic implementation. Best, Vicente

----- Original Message ----- From: "vicente.botet" <vicente.botet@wanadoo.fr> To: <boost@lists.boost.org> Sent: Saturday, January 01, 2011 9:27 PM Subject: Re: [boost] [ratio][mpl] static metafunctions
----- Original Message ----- From: "Aleksey Gurtovoy" <agurtovoy@meta-comm.com> To: <boost@lists.boost.org> 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@boostpro.com> wrote:
At Thu, 30 Dec 2010 22:45:12 +0100, vicente.botet wrote:
[1 <text/plain; iso-8859-1 (quoted-printable)>] 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 :).
I have added the modified files on https://svn.boost.org/svn/boost/sandbox/chrono/boost/mpl/ and https://svn.boost.org/svn/boost/sandbox/chrono/libs/mpl/
I've found useful to add the associated _c meta-functions, so we can request for gcd_c<int, 10, 6, 4> instead of gcd<int_<10>,int_<6>, int_<4>>. Let me know if you agree with this addition and if it is good to add them in the same file.
For the moment I have documented variadic metafunctions for gcd and lcm, but I have not yet take the time to understand how the variadic part is done for other arithmetic operations and if I can use it. I'm sure some of the maintainers could make the needed modifications quite quikly. If this is not the case I will change the documentation until I get the variadic implementation.
Hi, I would like to know if some of you are working on this or if I need to do something myself. Thanks, Vicente

On 30/12/10 22:45, 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? Sounds good :)
i guess they will turn into mpl::abs etc ? Lookign forward your patch
participants (4)
-
Aleksey Gurtovoy
-
Dave Abrahams
-
Joel Falcou
-
vicente.botet