26#ifndef GUL17_STRING_UTIL_H_
27#define GUL17_STRING_UTIL_H_
49template <
typename T,
typename =
int>
53 decltype(std::declval<T>().emplace_back(), 0)>> : std::true_type { };
57template <
typename Container,
typename Element>
59 -> std::enable_if_t<HasEmplaceBack<Container>::value>
61 c.emplace_back(std::move(
e));
64template <
typename Container,
typename Element>
66 -> std::enable_if_t<!HasEmplaceBack<Container>::value>
68 c.emplace(std::move(
e));
115 std::enable_if_t<std::is_integral<Integer>::value,
bool> =
true>
118 auto u =
static_cast<typename std::make_unsigned<Integer>::type
>(
v);
123 auto byte =
u >> (8 *
idx);
153template <
typename Iterator>
169 for (
auto it = std::next(begin);
it != end; ++
it)
199 std::enable_if_t<std::is_integral<Integer>::value,
bool> =
true>
224 std::enable_if_t<IsContainerLike<Container>::value,
bool> =
true>
312std::string
repeat(std::string_view
str, std::size_t
n);
auto constexpr bit_set(unsigned bit) noexcept -> ReturnT
Set a bit in an integral type.
Definition bit_manip.h:124
GUL_EXPORT const std::array< char, 16 > hex_digits
The 16 digits for hexadecimal numbers ("0123456789abcdef").
Definition string_util.cc:33
GUL_EXPORT const std::string_view default_whitespace_characters
The default characters that are treated as whitespace by GUL.
Definition string_util.cc:32
std::string hex_string(Integer v)
Return the hexadecimal ASCII representation of an integer value.
Definition string_util.h:116
GUL_EXPORT std::string safe_string(const char *char_ptr, std::size_t length)
Safely construct a std::string from a char pointer and a length, respecting null termination in the s...
Definition string_util.cc:77
GUL_EXPORT std::string_view null_safe_string_view(const char *char_ptr)
Safely construct a string_view from a C string or a null pointer.
Definition string_util.cc:46
GUL_EXPORT std::string_view safe_string_view(const char *char_ptr, std::size_t length)
Safely construct a string_view from a char pointer and a length, respecting null termination in the s...
Definition string_util.cc:87
GUL_EXPORT std::string repeat(std::string_view str, std::size_t n)
Repeat a string N times.
Definition string_util.cc:66
GUL_EXPORT std::string null_safe_string(const char *char_ptr)
Safely construct a std::string from a C string or a null pointer.
Definition string_util.cc:36
Definition of macros used internally by GUL.
Namespace gul17 contains all functions and classes of the General Utility Library.
Definition doxygen.h:29
Some metaprogramming traits for the General Utility Library.