SS.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <sstream>
4 #include <string>
5 #include <iostream>
6 
7 namespace iv
8 {
9 
10 class SS
11 {
12 public:
13 
14  SS();
15  SS( char const * val );
16 
17 // stream operations
18  struct str{};
19  std::string operator<<( str );
20  std::string operator<<( str ) const;
21 
22  struct c_str{};
23  char const * operator<<( c_str );
24  char const * operator<<( c_str ) const;
25 
26  template< class Type >
27  SS & operator<<( Type const & value );
28 
29 private:
30  std::ostringstream oss;
31  mutable std::string tmp;
32 };
33 
34 template< class Type >
35 SS & SS::operator<<( Type const & value )
36 {
37  ((std::ostream&)this->oss) << value;
38  return *this;
39 }
40 
41 }