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