source: NonGTP/Boost/boost/numeric/interval/ext/integer.hpp @ 857

Revision 857, 1.8 KB checked in by igarcia, 19 years ago (diff)
RevLine 
[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
16namespace boost {
17namespace numeric {
18
19template<class T, class Policies> inline
20interval<T, Policies> operator+ (const interval<T, Policies>& x, int y)
21{
22  return x + static_cast<T>(y);
23}
24
25template<class T, class Policies> inline
26interval<T, Policies> operator+ (int x, const interval<T, Policies>& y)
27{
28  return static_cast<T>(x) + y;
29}
30
31template<class T, class Policies> inline
32interval<T, Policies> operator- (const interval<T, Policies>& x, int y)
33{
34  return x - static_cast<T>(y);
35}
36
37template<class T, class Policies> inline
38interval<T, Policies> operator- (int x, const interval<T, Policies>& y)
39{
40  return static_cast<T>(x) - y;
41}
42
43template<class T, class Policies> inline
44interval<T, Policies> operator* (const interval<T, Policies>& x, int y)
45{
46  return x * static_cast<T>(y);
47}
48
49template<class T, class Policies> inline
50interval<T, Policies> operator* (int x, const interval<T, Policies>& y)
51{
52  return static_cast<T>(x) * y;
53}
54
55template<class T, class Policies> inline
56interval<T, Policies> operator/ (const interval<T, Policies>& x, int y)
57{
58  return x / static_cast<T>(y);
59}
60
61template<class T, class Policies> inline
62interval<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
Note: See TracBrowser for help on using the repository browser.