28 #include <type_traits>
69 const char *
data() const noexcept {
return sv_.data(); }
72 std::size_t
length() const noexcept {
return sv_.length(); }
75 std::size_t
size() const noexcept {
return sv_.size(); }
78 explicit operator std::string()
const {
return std::string(sv_); };
97 inline std::string
cat() {
return std::string(); }
104 std::string
cat(
const ConvertingStringView& s1,
const ConvertingStringView& s2);
108 std::string
cat(
const ConvertingStringView& s1,
const ConvertingStringView& s2,
109 const ConvertingStringView& s3);
113 std::string
cat(std::initializer_list<ConvertingStringView> pieces);
116 template <
typename... Args,
typename = std::enable_if_t<(
sizeof...(Args) > 3)>>
117 inline std::string
cat(
const Args&... args)
119 return cat({ args... });
A string view that can automatically convert numbers into strings.
Definition: cat.h:49
const char * data() const noexcept
Return a pointer to the internal character buffer.
Definition: cat.h:69
ConvertingStringView(int a)
Construct a ConvertingStringView from an integer.
Definition: cat.h:56
ConvertingStringView(long a)
Construct a ConvertingStringView from a long integer.
Definition: cat.h:58
ConvertingStringView(unsigned long long a)
Construct a ConvertingStringView from an unsigned long long integer.
Definition: cat.h:61
std::size_t size() const noexcept
Return the length of the string.
Definition: cat.h:75
ConvertingStringView(string_view sv)
Construct a ConvertingStringView from a string_view.
Definition: cat.h:52
ConvertingStringView(const std::string &str)
Construct a ConvertingStringView from a std::string.
Definition: cat.h:51
ConvertingStringView(long long a)
Construct a ConvertingStringView from a long long integer.
Definition: cat.h:60
ConvertingStringView(unsigned int a)
Construct a ConvertingStringView from an unsigned integer.
Definition: cat.h:57
ConvertingStringView(unsigned long a)
Construct a ConvertingStringView from an unsigned long integer.
Definition: cat.h:59
ConvertingStringView(double a)
Construct a ConvertingStringView from a double.
Definition: cat.h:63
ConvertingStringView(char c)
Construct a ConvertingStringView from a character.
Definition: cat.h:55
std::size_t length() const noexcept
Return the length of the string.
Definition: cat.h:72
ConvertingStringView(float a)
Construct a ConvertingStringView from a float.
Definition: cat.h:62
ConvertingStringView(const char *str)
Construct a ConvertingStringView from a const char *.
Definition: cat.h:53
std::string cat()
Efficiently concatenate an arbitrary number of strings and numbers.
Definition: cat.h:97
Definition of macros used internally by GUL.
Namespace gul14 contains all functions and classes of the General Utility Library.
Definition: doxygen.h:26
Provides a gul14::string_view that is fully compatible with C++17's std::string_view.