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