20 buffer.reserve(in.size() * 2);
25 auto& target = (cursor == std::string::npos) ? buffer : inplace_buffer;
27 auto lpos = target.size();
34 auto*
beg =
sv.data();
39 auto& target = (cursor == std::string::npos) ? buffer : inplace_buffer;
46 return std::move(buffer);
70 return stream << buf.buffer;
74 return buffer.size() + inplace_buffer.size();
83 if (!inplace_buffer.empty()) {
85 buffer.insert(cursor, inplace_buffer);
86 inplace_buffer.clear();
#define LIBREPR_ASSERT(cond,...)
Checked assertion, for constraint enforcement.
Definition assert.h:67
#define LIBREPR_HINT_INLINE
Definition macro/util.h:56
std::string code_for()
Definition repr:39
Wrapper around std::string.
Definition buffer.h:14
friend StringBuffer & operator<<(StringBuffer &buf, char c)
Definition buffer.h:63
LIBREPR_HINT_INLINE void write(std::string_view sv)
Definition buffer.h:33
LIBREPR_HINT_INLINE void write(char c)
Definition buffer.h:38
friend StringBuffer & operator<<(StringBuffer &buf, std::string_view sv)
Definition buffer.h:58
void set_cursor(std::size_t index=std::string::npos)
Definition buffer.h:77
LIBREPR_HINT_INLINE std::string && extract()
Definition buffer.h:43
friend std::ostream & operator<<(std::ostream &stream, StringBuffer &buf)
Definition buffer.h:68
StringBuffer(std::string_view in)
Definition buffer.h:17
std::size_t size()
Definition buffer.h:73
void write(const char *beg, const char *end)
Definition buffer.h:23
void flush()
Definition buffer.h:82
LIBREPR_HINT_INLINE const std::string * operator->() const
Definition buffer.h:54