5 Star 22 Fork 10

geoda/geoda_mirror

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
nullstream.h 1.21 KB
一键复制 编辑 原始数据 按行查看 历史
mmccann 提交于 2014-06-17 16:37 . GeoDa 1.6.0 trunk merge
//
// 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_H_INCLUDED
#define NULLSTREAM_H_INCLUDED
#include <streambuf>
#include <ostream>
// null stream buffer class
template <class charT, class traits = std::char_traits<charT> >
class NullBuffer : public std::basic_streambuf<charT, traits>
{
public:
typedef typename std::basic_streambuf<charT, traits>::int_type int_type;
NullBuffer() {}
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 GenericNullStream
: private NullBuffer<charT, traits>,
public std::basic_ostream<charT, traits>
{
public:
GenericNullStream()
: std::basic_ostream<charT, traits>(this)
{
}
};
// helper declarations for narrow and wide streams
typedef GenericNullStream<char> NullStream;
typedef GenericNullStream<wchar_t> WNullStream;
#endif
// NULLSTREAM_H_INCLUDED
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/geoda/geoda_mirror.git
[email protected]:geoda/geoda_mirror.git
geoda
geoda_mirror
geoda_mirror
master

搜索帮助