1#ifndef TEMPORARYSTRING_HH
2#define TEMPORARYSTRING_HH
47 [[nodiscard]]
char*
data() {
return ptr; }
48 [[nodiscard]]
const char*
c_str()
const {
return ptr; }
50 [[nodiscard]]
operator std::string_view()
const {
return {ptr, n}; }
57 std::array<char, BUFSIZE + 1> buffer;
62 os << std::string_view(str);
std::unique_ptr< char, FreeStringStorage > StringStorage
StringStorage allocate_string_storage(size_t size)
Allocate a 'StringStorage' large enough for 'size' characters.
std::ostream & operator<<(std::ostream &os, const TemporaryString &str)
static constexpr size_t BUFSIZE
TemporaryString & operator=(TemporaryString &&)=delete
const char * c_str() const
TemporaryString(TemporaryString &&)=delete
TemporaryString(const TemporaryString &)=delete
TemporaryString & operator=(const TemporaryString &)=delete
TemporaryString(size_t n_, std::invocable< char * > auto fillOp)
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.