Boost.Ratio: Added some mpl arithmetic operations + cleanup

[SVN r67588]
This commit is contained in:
Vicente J. Botet Escriba 2011-01-02 20:24:58 +00:00
parent cb02b93c96
commit 52ea879c56
5 changed files with 121 additions and 1 deletions

View File

@ -0,0 +1,30 @@
// divides.hpp
//
// (C) Copyright 2011 Vicente J. Botet Escriba
// Use, modification and distribution are subject to 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).
//
#ifndef BOOST_RATIO_MPL_DIVIDES_HPP
#define BOOST_RATIO_MPL_DIVIDES_HPP
#include <boost/ratio.hpp>
#include <boost/ratio/mpl/numeric_cast.hpp>
#include <boost/mpl/divides.hpp>
namespace boost {
namespace mpl {
template<>
struct divides_impl< rational_c_tag,rational_c_tag >
{
template< typename R1, typename R2 > struct apply
: ratio_divide<R1, R2>
{
};
};
}
}
#endif // BOOST_RATIO_MPL_DIVIDES_HPP

View File

@ -0,0 +1,30 @@
// minus.hpp
//
// (C) Copyright 2011 Vicente J. Botet Escriba
// Use, modification and distribution are subject to 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).
//
#ifndef BOOST_RATIO_MPL_MINUS_HPP
#define BOOST_RATIO_MPL_MINUS_HPP
#include <boost/ratio.hpp>
#include <boost/ratio/mpl/numeric_cast.hpp>
#include <boost/mpl/minus.hpp>
namespace boost {
namespace mpl {
template<>
struct minus_impl< rational_c_tag,rational_c_tag >
{
template< typename R1, typename R2 > struct apply
: ratio_subtract<R1, R2>
{
};
};
}
}
#endif // BOOST_RATIO_MPL_MINUS_HPP

View File

@ -0,0 +1,30 @@
// plus.hpp
//
// (C) Copyright 2011Vicente J. Botet Escriba
// Use, modification and distribution are subject to 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).
//
#ifndef BOOST_RATIO_MPL_PLUS_HPP
#define BOOST_RATIO_MPL_PLUS_HPP
#include <boost/ratio.hpp>
#include <boost/ratio/mpl/numeric_cast.hpp>
#include <boost/mpl/plus.hpp>
namespace boost {
namespace mpl {
template<>
struct plus_impl< rational_c_tag,rational_c_tag >
{
template< typename R1, typename R2 > struct apply
: ratio_add<R1, R2>
{
};
};
}
}
#endif // BOOST_RATIO_MPL_PLUS_HPP

View File

@ -16,7 +16,7 @@
namespace boost {
namespace mpl {
struct rational_c_tag : mpl::int_<10> {};
struct rational_c_tag : int_<10> {};
}
}

View File

@ -0,0 +1,30 @@
// times.hpp
//
// (C) Copyright 2011 Vicente J. Botet Escriba
// Use, modification and distribution are subject to 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).
//
#ifndef BOOST_RATIO_MPL_TIMES_HPP
#define BOOST_RATIO_MPL_TIMES_HPP
#include <boost/ratio.hpp>
#include <boost/ratio/mpl/numeric_cast.hpp>
#include <boost/mpl/times.hpp>
namespace boost {
namespace mpl {
template<>
struct times_impl< rational_c_tag,rational_c_tag >
{
template< typename R1, typename R2 > struct apply
: ratio_multiply<R1, R2>
{
};
};
}
}
#endif // BOOST_RATIO_MPL_TIMES_HPP