1 #ifndef C4_STD_VECTOR_HPP_
2 #define C4_STD_VECTOR_HPP_
9 #ifndef C4CORE_SINGLE_HEADER
13 #if defined(__GNUC__) && (__GNUC__ >= 6)
14 C4_SUPPRESS_WARNING_GCC_WITH_PUSH(
"-Wnull-dereference")
17 #if defined(__GNUC__) && (__GNUC__ >= 6)
18 C4_SUPPRESS_WARNING_GCC_POP
24 template<
class T>
struct is_string;
25 template<
class Alloc>
struct is_string<std::vector<char,Alloc>> :
public std::true_type {};
26 template<
class Alloc>
struct is_string<const std::vector<char,Alloc>> :
public std::true_type {};
39 char *data = vec.
empty() ?
nullptr : vec.data();
47 const char *data = vec.
empty() ?
nullptr : vec.data();
59 template<
class Alloc> C4_ALWAYS_INLINE
bool operator<= (c4::csubstr ss, std::vector<char, Alloc>
const& s) {
return ss <=
to_csubstr(s); }
60 template<
class Alloc> C4_ALWAYS_INLINE
bool operator< (c4::csubstr ss, std::vector<char, Alloc>
const& s) {
return ss <
to_csubstr(s); }
66 template<
class Alloc> C4_ALWAYS_INLINE
bool operator<= (std::vector<char, Alloc>
const& s,
c4::csubstr ss) {
return ss >=
to_csubstr(s); }
67 template<
class Alloc> C4_ALWAYS_INLINE
bool operator< (std::vector<char, Alloc>
const& s,
c4::csubstr ss) {
return ss >
to_csubstr(s); }
77 size_t len = buf.
len < sz ? buf.
len : sz;
87 substr(s->data(), buf.
len).copy_from(buf);
93 #endif // C4_STD_VECTOR_HPP_
bool operator!=(const char c, basic_substring< C > const that) noexcept
a traits class to mark a type as a writeable string type, meaning c4::to_substr() can be used directl...
substr to_substr(char(&s)[N]) noexcept
a non-owning string-view, consisting of a character pointer and a length.
bool from_chars(csubstr buf, uint8_t *v) 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...
csubstr to_csubstr(const char(&s)[N]) noexcept
basic_substring< char > substr
a mutable string view
basic_substring< const char > csubstr
an immutable string view
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 empty() const noexcept
size_t to_chars(substr buf, uint8_t v) noexcept
bool operator==(const char c, basic_substring< C > const that) noexcept