mirror of
https://github.com/boostorg/ratio.git
synced 2025-05-11 13:34:09 +00:00
Boost.Ratio: Added some mpl arithmetic operations + cleanup
[SVN r67588]
This commit is contained in:
parent
cb02b93c96
commit
52ea879c56
30
include/boost/ratio/mpl/divides.hpp
Normal file
30
include/boost/ratio/mpl/divides.hpp
Normal 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
|
30
include/boost/ratio/mpl/minus.hpp
Normal file
30
include/boost/ratio/mpl/minus.hpp
Normal 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
|
30
include/boost/ratio/mpl/plus.hpp
Normal file
30
include/boost/ratio/mpl/plus.hpp
Normal 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
|
@ -16,7 +16,7 @@
|
|||||||
namespace boost {
|
namespace boost {
|
||||||
namespace mpl {
|
namespace mpl {
|
||||||
|
|
||||||
struct rational_c_tag : mpl::int_<10> {};
|
struct rational_c_tag : int_<10> {};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
30
include/boost/ratio/mpl/times.hpp
Normal file
30
include/boost/ratio/mpl/times.hpp
Normal 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
|
Loading…
x
Reference in New Issue
Block a user