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

📄 nullstream.hpp

📁 CGAL is a collaborative effort of several sites in Europe and Israel. The goal is to make the most i
💻 HPP
字号:
//  (C) Copyright Gennadiy Rozental 2002-2003.//  (C) Copyright Daryle Walker 2000-2001. //  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)//  See http://www.boost.org/libs/test for the library home page.////  File        : $RCSfile: nullstream.hpp,v $////  Version     : $Revision: 1.1.1.2 $////  Description : simulate /dev/null stream// ***************************************************************************#ifndef BOOST_NULLSTREAM_HPP_071894GER#define BOOST_NULLSTREAM_HPP_071894GER#include <ostream>    // for std::basic_ostream#include <streambuf>  // for std::basic_streambuf#include <string>     // for std::char_traits#include <boost/utility/base_from_member.hpp>namespace boost {// ************************************************************************** //// **************                 basic_nullbuf                ************** //// ************************************************************************** ////  Class for a buffer that reads nothing and writes to nothing.//  Idea from an Usenet post by Tom <the_wid@my-deja.com> at//  27 Oct 2000 14:06:21 GMT on comp.lang.c++.template<typename CharType, class CharTraits = ::std::char_traits<CharType> >class basic_nullbuf : public ::std::basic_streambuf<CharType, CharTraits> {    typedef ::std::basic_streambuf<CharType, CharTraits>  base_type;public:    // Types    typedef typename base_type::char_type    char_type;    typedef typename base_type::traits_type  traits_type;    typedef typename base_type::int_type     int_type;    typedef typename base_type::pos_type     pos_type;    typedef typename base_type::off_type     off_type;    // Use automatic default constructor and destructorprotected:    // The default implementations of the miscellaneous virtual    // member functions are sufficient.    // The default implementations of the input & putback virtual    // member functions, being nowhere but EOF, are sufficient.    // The output virtual member functions need to be changed to    // accept anything without any problems, instead of being at EOF.    virtual  ::std::streamsize  xsputn( char_type const* /*s*/, ::std::streamsize n )   { return n; } // "s" is unused    virtual  int_type           overflow( int_type c = traits_type::eof() )         { return traits_type::not_eof( c ); }};typedef basic_nullbuf<char>      nullbuf;typedef basic_nullbuf<wchar_t>  wnullbuf;// ************************************************************************** //// **************               basic_onullstream              ************** //// ************************************************************************** ////  Output streams based on basic_nullbuf.template< typename CharType, class CharTraits = ::std::char_traits<CharType> >class basic_onullstream : private boost::base_from_member<basic_nullbuf<CharType, CharTraits> >                        , public ::std::basic_ostream<CharType, CharTraits> {    typedef boost::base_from_member<basic_nullbuf<CharType, CharTraits> >   pbase_type;    typedef ::std::basic_ostream<CharType, CharTraits>                      base_type;public:    // Constructor    basic_onullstream() : pbase_type(), base_type( &this->pbase_type::member ) {}};typedef basic_onullstream<char>      onullstream;typedef basic_onullstream<wchar_t>  wonullstream;}  // namespace boost// ***************************************************************************//  Revision History ://  //  $Log: nullstream.hpp,v $//  Revision 1.1.1.2  2004/11/20 10:52:19  spion//  Import of Boost v. 1.32.0////  Revision 1.9  2004/07/19 12:21:08  rogeeff//  guard rename////  Revision 1.8  2004/05/21 06:19:35  rogeeff//  licence update////  Revision 1.7  2003/12/01 00:41:56  rogeeff//  prerelease cleaning//// ***************************************************************************#endif  // BOOST_NULLSTREAM_HPP_071894GER

⌨️ 快捷键说明

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