ViennaSHE 1.3.0
Free open-source semiconductor device simulator using spherical harmonics expansions techniques.
nullstream.hpp
Go to the documentation of this file.
1#ifndef VIENNASHE_LOG_NULLSTREAM_HPP
2#define VIENNASHE_LOG_NULLSTREAM_HPP
3
4/* ============================================================================
5 Copyright (c) 2011-2022, Institute for Microelectronics,
6 Institute for Analysis and Scientific Computing,
7 TU Wien.
8
9 -----------------
10 ViennaSHE - The Vienna Spherical Harmonics Expansion Boltzmann Solver
11 -----------------
12
13 http://viennashe.sourceforge.net/
14
15 License: MIT (X11), see file LICENSE in the base directory
16=============================================================================== */
17
18#include <iosfwd>
19#include <memory>
20
25namespace viennashe
26{
27 namespace log
28 {
29
31 struct nullstream {};
32
38 {
39 // not exactly singleton, but enough for our purpose
40 //static std::auto_ptr<nullstream> stnull(new nullstream());
41 static std::unique_ptr<nullstream> stnull(new nullstream());
42 return *stnull;
43 }
44
49 template <typename T>
50 nullstream & operator<<(nullstream & s, T const &) { return s; }
51
53 inline nullstream & operator<<(nullstream & s, const std::string &) { return s; }
55 inline nullstream & operator<<(nullstream & s, const char * ) { return s; }
56
58 inline nullstream & operator<<(nullstream & s, std::ostream &(std::ostream&)) { return s; }
59
60
61 } // log
62} // viennashe
63
64
65#endif
66
nullstream & get_nullstream()
Singleton factory for nullstream.
Definition: nullstream.hpp:37
nullstream & operator<<(nullstream &s, T const &)
Generic shift left operator. Throws anything it gets away.
Definition: nullstream.hpp:50
The main ViennaSHE namespace. All functionality resides inside this namespace.
Definition: accessors.hpp:40
Streaming class which only provides operator<< discarding the right hand side.
Definition: nullstream.hpp:31