Fix util::ostringstream, fix pretty-printing, stub out new globals
This commit is contained in:
@@ -68,23 +68,27 @@ double get_monotonic_clock();
|
||||
// without copying, use oss.size() and oss.c_str()
|
||||
//
|
||||
class ostringstream : public std::ostringstream {
|
||||
class rstringbuf : public std::stringbuf {
|
||||
class rstringbuf : public std::basic_stringbuf<char_type, traits_type, allocator_type> {
|
||||
public:
|
||||
char *eback() { return std::streambuf::eback(); }
|
||||
char *eback() const { return std::streambuf::eback(); }
|
||||
char *pptr() const { return std::streambuf::pptr(); }
|
||||
};
|
||||
rstringbuf rsbuf_;
|
||||
rstringbuf rstringbuf_;
|
||||
public:
|
||||
ostringstream() {
|
||||
std::basic_ostream<char>::rdbuf(&rsbuf_);
|
||||
std::basic_ostream<char>::rdbuf(&rstringbuf_);
|
||||
}
|
||||
size_t size() {
|
||||
return tellp();
|
||||
std::string_view view() const {
|
||||
char *p = rstringbuf_.eback();
|
||||
size_t size = rstringbuf_.pptr() - p;
|
||||
return std::string_view(p, size);
|
||||
}
|
||||
const char *c_str() {
|
||||
return rsbuf_.eback();
|
||||
std::string str() const {
|
||||
return rstringbuf_.str();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Remove items from a vector that are marked for deletion.
|
||||
//
|
||||
template<class T>
|
||||
|
||||
Reference in New Issue
Block a user