1 #ifndef C4_STD_STRING_VIEW_HPP_
2 #define C4_STD_STRING_VIEW_HPP_
6 #ifndef C4CORE_SINGLE_HEADER
7 #ifndef C4_LANGUAGE_HPP_
8 #include "c4/language.hpp"
12 #if (C4_CPP >= 17 && defined(__cpp_lib_string_view)) || defined(__DOXYGEN__)
14 #ifndef C4CORE_SINGLE_HEADER
15 #ifndef C4_SUBSTR_HPP_
20 #include <string_view>
26 template<
class T>
struct is_string;
27 template<>
struct is_string<std::string_view> :
public std::true_type {};
28 template<>
struct is_string<const std::string_view> :
public std::true_type {};
63 size_t len = buf.
len < sz ? buf.
len : sz;
70 #endif // STRING_VIEW_AVAILABLE
72 #endif // C4_STD_STRING_VIEW_HPP_
bool operator!=(const char c, basic_substring< C > const that) noexcept
bool operator>=(const char c, basic_substring< C > const that) noexcept
bool operator>(const char c, basic_substring< C > const that) noexcept
a traits class to mark a type as a string type, meaning c4::to_csubstr() can be used directly instead...
int compare(C const c) const noexcept
csubstr to_csubstr(const char(&s)[N]) noexcept
basic_substring< const char > csubstr
an immutable string view
bool operator<(const char c, basic_substring< C > const that) noexcept
auto copy_from(ro_substr that) -> typename std::enable_if< !std::is_const< U >::value, void >::type
copy a string to this substr, starting at 0
size_t len
the length of the substring
bool operator<=(const char c, basic_substring< C > const that) noexcept
size_t to_chars(substr buf, uint8_t v) noexcept
bool operator==(const char c, basic_substring< C > const that) noexcept