io.hpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #ifndef BOOST_NUMERIC_INTERVAL_IO_HPP
  17. #define BOOST_NUMERIC_INTERVAL_IO_HPP
  18. #include <boost/numeric/interval/interval.hpp>
  19. #include <boost/numeric/interval/utility.hpp>
  20. #include <ostream>
  21. namespace boost {
  22. namespace numeric {
  23. template<class CharType, class CharTraits, class T, class Policies>
  24. std::basic_ostream<CharType, CharTraits> &operator<<
  25. (std::basic_ostream<CharType, CharTraits> &stream,
  26. interval<T, Policies> const &value)
  27. {
  28. if (empty(value))
  29. return stream << "[]";
  30. else
  31. return stream << '[' << lower(value) << ',' << upper(value) << ']';
  32. }
  33. } // namespace numeric
  34. } // namespace boost
  35. #endif // BOOST_NUMERIC_INTERVAL_IO_HPP