34 lines
519 B
C++
34 lines
519 B
C++
#ifndef DYNAMIC_PROGRAM_NULL_BUFFER_H
|
|
#define DYNAMIC_PROGRAM_NULL_BUFFER_H
|
|
|
|
#include <iosfwd>
|
|
|
|
namespace NullBuffer
|
|
{
|
|
|
|
class NullBuffer final : public std::streambuf
|
|
{
|
|
public:
|
|
int overflow(int c) override
|
|
{ return c; }
|
|
};
|
|
|
|
/**
|
|
* A Stream that does nothing on writing to it
|
|
*/
|
|
class NullStream final : public std::ostream
|
|
{
|
|
public:
|
|
NullStream() : std::ostream(&_m_sb)
|
|
{}
|
|
|
|
private:
|
|
NullBuffer _m_sb;
|
|
};
|
|
|
|
NullStream null_stream;
|
|
|
|
}
|
|
|
|
|
|
#endif //DYNAMIC_PROGRAM_NULL_BUFFER_H
|