pvif: DBCH cleanup

avoid some duplication
This commit is contained in:
Michael Davidsaver
2018-02-14 11:10:09 -08:00
parent 392a44b791
commit d229efbb66
3 changed files with 25 additions and 7 deletions

16
common/sb.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef SB_H
#define SB_H
#include <sstream>
// in-line string builder (eg. for exception messages)
// throw std::runtime_error(SB()<<"Answer: !"<<42);
struct SB {
std::ostringstream strm;
SB() {}
operator std::string() const { return strm.str(); }
template<typename T>
SB& operator<<(T i) { strm<<i; return *this; }
};
#endif // SB_H