Index: abs.hpp =================================================================== --- abs.hpp (revision 0) +++ abs.hpp (revision 0) @@ -0,0 +1,79 @@ +//////////////////////////////////////////////////////////////////// +// +// Copyright Vicente J. Botet Escriba 2010 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. +// +//////////////////////////////////////////////////////////////////// +#ifndef BOOST_MPL_ABS_HPP_INCLUDED +#define BOOST_MPL_ABS_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace mpl { + +template< typename Tag > struct abs_impl; + +template< typename T > struct abs_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N) + > +struct abs +#if !defined(BOOST_MPL_CFG_MSVC_ETI_BUG) + : abs_impl< + typename abs_tag::type + >::template apply::type +#else + : aux::msvc_eti_base< typename apply_wrap1< + abs_impl< typename abs_tag::type > + , N + >::type >::type +#endif +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1, abs, (N)) +}; + +BOOST_MPL_AUX_NA_SPEC(1, abs) + + +#if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) +namespace aux { +template< typename T, T n > struct abs_wknd +{ + BOOST_STATIC_CONSTANT(T, value = (n < 0 ? -n : n)); + typedef integral_c type; +}; +} +#endif + +template<> +struct abs_impl +{ +#if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) + template< typename N > struct apply + : aux::abs_wknd< typename N::value_type, N::value > +#else + template< typename N > struct apply + : integral_c< typename N::value_type, ((N::value < 0) ? (-N::value) : N::value ) > +#endif + { + }; +}; + +}} + +#endif // BOOST_MPL_ABS_HPP_INCLUDED Property changes on: abs.hpp ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Index: aux_/config/integral.hpp =================================================================== --- aux_/config/integral.hpp (revision 67279) +++ aux_/config/integral.hpp (working copy) @@ -35,4 +35,14 @@ #endif +#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 + #endif // BOOST_MPL_AUX_CONFIG_INTEGRAL_HPP_INCLUDED Index: gcd.hpp =================================================================== --- gcd.hpp (revision 0) +++ gcd.hpp (revision 0) @@ -0,0 +1,83 @@ +//////////////////////////////////////////////////////////////////// +// +// Copyright Vicente J. Botet Escriba 2010 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. +// +//////////////////////////////////////////////////////////////////// +#ifndef BOOST_MPL_GCD_HPP_INCLUDED +#define BOOST_MPL_GCD_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace mpl { + +template< typename Tag1, typename Tag2 > struct gcd_impl; + +template< typename T > struct gcd_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + > +struct gcd +//~ #if !defined(BOOST_MPL_CFG_MSVC_ETI_BUG) + : gcd_impl< + typename gcd_tag::type + , typename gcd_tag::type + >::template apply::type +//~ #else + //~ : aux::msvc_eti_base< typename apply_wrap1< + //~ gcd_impl< typename gcd_tag::type > + //~ , N1 + //~ >::type >::type +//~ #endif +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(2, gcd, (N1, N2)) +}; + +BOOST_MPL_AUX_NA_SPEC(2, gcd) + + +namespace aux { + template< typename T1, T1 n1, bool n1_is_0, typename T2, T2 n2, bool n2_is_0 > + struct gcd_aux + + : gcd_aux + {}; + + template + struct gcd_aux : integral_constant + {}; + + template + struct gcd_aux : integral_constant + {}; +} + +template<> +struct gcd_impl +{ + template< typename N1, typename N2 > struct apply + : aux::gcd_aux< typename N1::value_type, N1::value, N1::value==0, + typename N2::value_type, N2::value, N2::value==0 > + { + }; +}; + +}} + +#endif // BOOST_MPL_GCD_HPP_INCLUDED Property changes on: gcd.hpp ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Index: sign.hpp =================================================================== --- sign.hpp (revision 0) +++ sign.hpp (revision 0) @@ -0,0 +1,79 @@ +//////////////////////////////////////////////////////////////////// +// +// Copyright Vicente J. Botet Escriba 2010 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. +// +//////////////////////////////////////////////////////////////////// +#ifndef BOOST_MPL_SIGN_HPP_INCLUDED +#define BOOST_MPL_SIGN_HPP_INCLUDED + +#include +#include +#include +#include +#include +#include +#include + +namespace boost { namespace mpl { + +template< typename Tag > struct sign_impl; + +template< typename T > struct sign_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N) + > +struct sign +#if !defined(BOOST_MPL_CFG_MSVC_ETI_BUG) + : sign_impl< + typename sign_tag::type + >::template apply::type +#else + : aux::msvc_eti_base< typename apply_wrap1< + sign_impl< typename sign_tag::type > + , N + >::type >::type +#endif +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1, sign, (N)) +}; + +BOOST_MPL_AUX_NA_SPEC(1, sign) + + +#if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) +namespace aux { +template< typename T, T n > struct sign_wknd +{ + BOOST_STATIC_CONSTANT(T, value = (n == 0 ? 0 : (n < 0 ? -1 : 1))); + typedef integral_c type; +}; +} +#endif + +template<> +struct sign_impl +{ +#if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) + template< typename N > struct apply + : aux::sign_wknd< typename N::value_type, N::value > +#else + template< typename N > struct apply + : integral_c< typename N::value_type, (N::value == 0 ? 0 : (N::value < 0 ? -1 : 1)) > +#endif + { + }; +}; + +}} + +#endif // BOOST_MPL_SIGN_HPP_INCLUDED Property changes on: sign.hpp ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native