Add util::null_ostream
This commit is contained in:
parent
5138e00c35
commit
6971b8545a
1 changed files with 28 additions and 0 deletions
28
libs/util/include/psemek/util/null_ostream.hpp
Normal file
28
libs/util/include/psemek/util/null_ostream.hpp
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
namespace psemek::util
|
||||||
|
{
|
||||||
|
|
||||||
|
struct null_ostream
|
||||||
|
{
|
||||||
|
null_ostream & write(char const *, std::size_t)
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
null_ostream & operator << (null_ostream & os, T const &)
|
||||||
|
{
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
null_ostream && operator << (null_ostream && os, T const &)
|
||||||
|
{
|
||||||
|
return std::move(os);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue