//// Copyright 2021 Glen Joseph Fernandes (glenjofe@gmail.com) Distributed under the Boost Software License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) //// # Null Streams, :toc: :toc-title: :idprefix: ## Description The header `` provides the class template `boost::io::basic_nullbuf` which is a null stream buffer and class template `boost::io::basic_onullstream` which is a null stream. ## Example The following program passes a null stream to a function. ``` #include #include void setup(std::ostream& log); int main(int argc, char* argv[]) { if (argc == 2) { std::ofstream file(argv[1]); setup(file); } else { boost::io::onullstream none; setup(none); } } ``` ## Reference ### Header Synopsis ``` namespace boost { namespace io { template > class basic_nullbuf : public std::basic_streambuf { protected: typename Traits::int_type overflow(typename Traits::int_type c) override; std::streamsize xsputn(const CharT*, std::streamsize n) override; }; template > class basic_onullstream : public std::basic_ostream { public: basic_onullstream(); }; typedef basic_onullstream onullstream; typedef basic_onullstream wonullstream; } // io } // boost ``` ## Acknowledgments Glen Fernandes implemented `basic_nullbuf` and `basic_onullstream`.