32#ifndef SYSC_UTILS_STRING_VIEW_H_INCLUDED_
33#define SYSC_UTILS_STRING_VIEW_H_INCLUDED_
45 :
public std::string_view
47 typedef std::string_view base_type;
48 template<
typename T>
struct enable_if_convertible
49 : std::enable_if<std::is_convertible<T,base_type>::value > {};
52 using base_type::base_type;
57 ,
typename enable_if_convertible<T>::type* = 0)
61 inline std::string
str()
const
62 {
return std::string( data(), size() ); }
64#if SC_CPLUSPLUS <= 201703L
66 {
return size() >= sv.size() && compare(0, sv.size(), sv) == 0; }
68 {
return !empty() && front() == c; }
73 {
return size() >= sv.size() && compare(size() - sv.size(), npos, sv) == 0; }
75 {
return !empty() && back() == c; }
94 : base_type(s.c_str()) {}
97 { base_type::swap(s); }
104 using sc_string_view::remove_suffix;
non-owning, constant reference to a string
bool starts_with(const char *s) const
bool ends_with(char c) const
bool ends_with(const char *s) const
bool starts_with(char c) const
bool starts_with(base_type sv) const
sc_string_view(const T &s, typename enable_if_convertible< T >::type *=0)
bool ends_with(base_type sv) const
non-owning, constant reference to null-terminated string
sc_zstring_view(const char *s)
void swap(sc_zstring_view &s)
const char * c_str() const
sc_zstring_view(const std::string &s)