Files
pva2pva/common/sb.h
Michael Davidsaver d229efbb66 pvif: DBCH cleanup
avoid some duplication
2018-02-14 11:10:09 -08:00

17 lines
360 B
C++

#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