1 /* Boost interval/ext/integer.hpp template implementation file
3 * Copyright 2003 Guillaume Melquiond
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)
10 #ifndef BOOST_NUMERIC_INTERVAL_EXT_INTEGER_HPP
11 #define BOOST_NUMERIC_INTERVAL_EXT_INTEGER_HPP
13 #include <boost/numeric/interval/detail/interval_prototype.hpp>
14 #include <boost/numeric/interval/detail/test_input.hpp>
19 template<class T
, class Policies
> inline
20 interval
<T
, Policies
> operator+ (const interval
<T
, Policies
>& x
, int y
)
22 return x
+ static_cast<T
>(y
);
25 template<class T
, class Policies
> inline
26 interval
<T
, Policies
> operator+ (int x
, const interval
<T
, Policies
>& y
)
28 return static_cast<T
>(x
) + y
;
31 template<class T
, class Policies
> inline
32 interval
<T
, Policies
> operator- (const interval
<T
, Policies
>& x
, int y
)
34 return x
- static_cast<T
>(y
);
37 template<class T
, class Policies
> inline
38 interval
<T
, Policies
> operator- (int x
, const interval
<T
, Policies
>& y
)
40 return static_cast<T
>(x
) - y
;
43 template<class T
, class Policies
> inline
44 interval
<T
, Policies
> operator* (const interval
<T
, Policies
>& x
, int y
)
46 return x
* static_cast<T
>(y
);
49 template<class T
, class Policies
> inline
50 interval
<T
, Policies
> operator* (int x
, const interval
<T
, Policies
>& y
)
52 return static_cast<T
>(x
) * y
;
55 template<class T
, class Policies
> inline
56 interval
<T
, Policies
> operator/ (const interval
<T
, Policies
>& x
, int y
)
58 return x
/ static_cast<T
>(y
);
61 template<class T
, class Policies
> inline
62 interval
<T
, Policies
> operator/ (int x
, const interval
<T
, Policies
>& y
)
64 return static_cast<T
>(x
) / y
;
67 } // namespace numeric
70 #endif // BOOST_NUMERIC_INTERVAL_EXT_INTEGER_HPP