⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 io.cpp

📁 C++的一个好库。。。现在很流行
💻 CPP
字号:
/* Boost examples/io.cpp
 * show some exampleso of i/o operators
 * thanks to all the people who commented on this point, particularly on
 * the Boost mailing-list
 *
 * Copyright 2003 Guillaume Melquiond
 *
 * Distributed under the Boost Software License, Version 1.0.
 * (See accompanying file LICENSE_1_0.txt or
 * copy at http://www.boost.org/LICENSE_1_0.txt)
 */

#include <boost/numeric/interval.hpp>
#include <boost/io/ios_state.hpp>
#include <cmath>
#include <cassert>

namespace io_std {

template<class T, class Policies, class CharType, class CharTraits>
std::basic_ostream<CharType, CharTraits> &operator<<
  (std::basic_ostream<CharType, CharTraits> &stream,
   const boost::numeric::interval<T, Policies> &value)
{
  if (empty(value)) {
    return stream << "[]";
  } else {
    return stream << '[' << lower(value) << ',' << upper(value) << ']';
  }
}

} // namespace io_std

namespace io_sngl {

template<class T, class Policies, class CharType, class CharTraits>
std::basic_ostream<CharType, CharTraits> &operator<<
  (std::basic_ostream<CharType, CharTraits> &stream,
   const boost::numeric::interval<T, Policies> &value)
{
  if (empty(value)) {
    return stream << "[]";
  } else if (singleton(value)) {
    return stream << '[' << lower(value) << ']';
  } else {
    return stream << '[' << lower(value) << ',' << upper(value) << ']';
  }
}

} // namespace io_sngl

namespace io_wdth {

template<class T, class Policies, class CharType, class CharTraits>
std::basic_ostream<CharType, CharTraits> &operator<<
  (std::basic_ostream<CharType, CharTraits> &stream,
   const boost::numeric::interval<T, Policies> &value)
{
  if (empty(value)) {
    return stream << "nothing";
  } else {
    return stream << median(value) << " 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -