sl@0
|
1 |
/* Boost interval/io.hpp header file
|
sl@0
|
2 |
*
|
sl@0
|
3 |
* This file is only meant to provide a quick
|
sl@0
|
4 |
* implementation of the output operator. It is
|
sl@0
|
5 |
* provided for test programs that aren't even
|
sl@0
|
6 |
* interested in the precision of the results.
|
sl@0
|
7 |
* A real progam should define its own operators
|
sl@0
|
8 |
* and never include this header.
|
sl@0
|
9 |
*
|
sl@0
|
10 |
* Copyright 2003 Guillaume Melquiond
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Distributed under the Boost Software License, Version 1.0.
|
sl@0
|
13 |
* (See accompanying file LICENSE_1_0.txt or
|
sl@0
|
14 |
* copy at http://www.boost.org/LICENSE_1_0.txt)
|
sl@0
|
15 |
*/
|
sl@0
|
16 |
|
sl@0
|
17 |
#ifndef BOOST_NUMERIC_INTERVAL_IO_HPP
|
sl@0
|
18 |
#define BOOST_NUMERIC_INTERVAL_IO_HPP
|
sl@0
|
19 |
|
sl@0
|
20 |
#include <boost/numeric/interval/interval.hpp>
|
sl@0
|
21 |
#include <boost/numeric/interval/utility.hpp>
|
sl@0
|
22 |
#include <ostream>
|
sl@0
|
23 |
|
sl@0
|
24 |
namespace boost {
|
sl@0
|
25 |
namespace numeric {
|
sl@0
|
26 |
|
sl@0
|
27 |
template<class CharType, class CharTraits, class T, class Policies>
|
sl@0
|
28 |
std::basic_ostream<CharType, CharTraits> &operator<<
|
sl@0
|
29 |
(std::basic_ostream<CharType, CharTraits> &stream,
|
sl@0
|
30 |
interval<T, Policies> const &value)
|
sl@0
|
31 |
{
|
sl@0
|
32 |
if (empty(value))
|
sl@0
|
33 |
return stream << "[]";
|
sl@0
|
34 |
else
|
sl@0
|
35 |
return stream << '[' << lower(value) << ',' << upper(value) << ']';
|
sl@0
|
36 |
}
|
sl@0
|
37 |
|
sl@0
|
38 |
} // namespace numeric
|
sl@0
|
39 |
} // namespace boost
|
sl@0
|
40 |
|
sl@0
|
41 |
#endif // BOOST_NUMERIC_INTERVAL_IO_HPP
|