nulloutstream.hpp

Go to the documentation of this file.
00001 
00023 #ifndef __MLPACK_CORE_UTIL_NULLOUTSTREAM_HPP
00024 #define __MLPACK_CORE_UTIL_NULLOUTSTREAM_HPP
00025 
00026 #include <iostream>
00027 #include <streambuf>
00028 #include <string>
00029 
00030 namespace mlpack {
00031 namespace util {
00032 
00037 class NullOutStream
00038 {
00039  public:
00043   NullOutStream() { }
00044 
00048   NullOutStream(const NullOutStream& /* other */) { }
00049 
00050   /*
00051    We use (void) paramName in order to avoid the warning generated by
00052    -Wextra. For some currently unknown reason, simply deleting the
00053    parameter name (aka, outperator<<(bool) {...}) causes a compilation
00054    error (with -Werror off) for only this class.
00055    */
00056 
00058   NullOutStream& operator<<(bool val) { (void) val; return *this; }
00060   NullOutStream& operator<<(short val) { (void) val; return *this; }
00062   NullOutStream& operator<<(unsigned short val) { (void) val; return *this; }
00064   NullOutStream& operator<<(int val) { (void) val; return *this; }
00066   NullOutStream& operator<<(unsigned int val) { (void) val; return *this; }
00068   NullOutStream& operator<<(long val) { (void) val; return *this; }
00070   NullOutStream& operator<<(unsigned long val) { (void) val; return *this; }
00072   NullOutStream& operator<<(float val) { (void) val; return *this; }
00074   NullOutStream& operator<<(double val) { (void) val; return *this; }
00076   NullOutStream& operator<<(long double val) { (void) val; return *this; }
00078   NullOutStream& operator<<(void* val) { (void) val; return *this; }
00080   NullOutStream& operator<<(const char* str) { (void) str; return *this; }
00082   NullOutStream& operator<<(std::string& str) { (void) str; return *this; }
00084   NullOutStream& operator<<(std::streambuf* sb) { (void) sb; return *this; }
00086   NullOutStream& operator<<(std::ostream& (*pf) (std::ostream&))
00087   { (void) pf; return *this; }
00089   NullOutStream& operator<<(std::ios& (*pf) (std::ios&)) { (void) pf; return *this; }
00091   NullOutStream& operator<<(std::ios_base& (*pf) (std::ios_base&))
00092   { (void) pf; return *this; }
00093 
00095   template<typename T>
00096   NullOutStream& operator<<(T& s)
00097   { (void) s; return *this; }
00098 };
00099 
00100 } // namespace util
00101 } // namespace mlpack
00102 
00103 #endif

Generated on 29 Sep 2016 for MLPACK by  doxygen 1.6.1