[857] | 1 | /* Boost interval/ext/integer.hpp template implementation file
|
---|
| 2 | *
|
---|
| 3 | * Copyright 2003 Guillaume Melquiond
|
---|
| 4 | *
|
---|
| 5 | * Distributed under the Boost Software License, Version 1.0.
|
---|
| 6 | * (See accompanying file LICENSE_1_0.txt or
|
---|
| 7 | * copy at http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 8 | */
|
---|
| 9 |
|
---|
| 10 | #ifndef BOOST_NUMERIC_INTERVAL_EXT_INTEGER_HPP
|
---|
| 11 | #define BOOST_NUMERIC_INTERVAL_EXT_INTEGER_HPP
|
---|
| 12 |
|
---|
| 13 | #include <boost/numeric/interval/detail/interval_prototype.hpp>
|
---|
| 14 | #include <boost/numeric/interval/detail/test_input.hpp>
|
---|
| 15 |
|
---|
| 16 | namespace boost {
|
---|
| 17 | namespace numeric {
|
---|
| 18 |
|
---|
| 19 | template<class T, class Policies> inline
|
---|
| 20 | interval<T, Policies> operator+ (const interval<T, Policies>& x, int y)
|
---|
| 21 | {
|
---|
| 22 | return x + static_cast<T>(y);
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | template<class T, class Policies> inline
|
---|
| 26 | interval<T, Policies> operator+ (int x, const interval<T, Policies>& y)
|
---|
| 27 | {
|
---|
| 28 | return static_cast<T>(x) + y;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | template<class T, class Policies> inline
|
---|
| 32 | interval<T, Policies> operator- (const interval<T, Policies>& x, int y)
|
---|
| 33 | {
|
---|
| 34 | return x - static_cast<T>(y);
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | template<class T, class Policies> inline
|
---|
| 38 | interval<T, Policies> operator- (int x, const interval<T, Policies>& y)
|
---|
| 39 | {
|
---|
| 40 | return static_cast<T>(x) - y;
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | template<class T, class Policies> inline
|
---|
| 44 | interval<T, Policies> operator* (const interval<T, Policies>& x, int y)
|
---|
| 45 | {
|
---|
| 46 | return x * static_cast<T>(y);
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | template<class T, class Policies> inline
|
---|
| 50 | interval<T, Policies> operator* (int x, const interval<T, Policies>& y)
|
---|
| 51 | {
|
---|
| 52 | return static_cast<T>(x) * y;
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | template<class T, class Policies> inline
|
---|
| 56 | interval<T, Policies> operator/ (const interval<T, Policies>& x, int y)
|
---|
| 57 | {
|
---|
| 58 | return x / static_cast<T>(y);
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | template<class T, class Policies> inline
|
---|
| 62 | interval<T, Policies> operator/ (int x, const interval<T, Policies>& y)
|
---|
| 63 | {
|
---|
| 64 | return static_cast<T>(x) / y;
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | } // namespace numeric
|
---|
| 68 | } // namespace boost
|
---|
| 69 |
|
---|
| 70 | #endif // BOOST_NUMERIC_INTERVAL_EXT_INTEGER_HPP
|
---|