Слияние кода завершено, страница обновится автоматически
//
// Copyright (c) 2006 - 2010
// Seweryn Habdank-Wojewodzki
//
// Distributed under the Boost Software License, Version 1.0.
// ( copy at http://www.boost.org/LICENSE_1_0.txt )
//
// Copyright Maciej Sobczak, 2002
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
#ifndef NULLSTREAM_HPP_INCLUDED
#define NULLSTREAM_HPP_INCLUDED 1
#include <streambuf>
#include <ostream>
// null stream buffer class
template <class charT, class traits = ::std::char_traits<charT> >
class null_buffer : public ::std::basic_streambuf<charT, traits>
{
public:
typedef typename ::std::basic_streambuf<charT, traits>::int_type int_type;
null_buffer() {}
private:
virtual int_type overflow(int_type c)
{
// just ignore the character
return traits::not_eof(c);
}
};
// generic null output stream class
template <class charT, class traits = ::std::char_traits<charT> >
class basic_null_stream
: private null_buffer<charT, traits>,
public ::std::basic_ostream<charT, traits>
{
public:
basic_null_stream()
// C++98 standard allows that construction
// 12.6.2/7
: ::std::basic_ostream<charT, traits>(this)
{
}
};
// helper declarations for narrow and wide streams
typedef basic_null_stream<char> null_stream;
typedef basic_null_stream<wchar_t> null_wstream;
#endif // NULLSTREAM_HPP_INCLUDED
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )