1 #ifndef TEMPORARYSTRING_HH
2 #define TEMPORARYSTRING_HH
46 [[nodiscard]]
char*
data() {
return ptr; }
47 [[nodiscard]]
const char*
c_str()
const {
return ptr; }
49 [[nodiscard]]
operator std::string_view()
const {
return {ptr, n}; }
61 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)
const char * c_str() const
static constexpr size_t BUFSIZE
TemporaryString(TemporaryString &&)=delete
TemporaryString & operator=(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.