30 : dat(nullptr), siz(0) {}
32 : dat(s.dat), siz(s.siz) {}
34 : dat(s), siz(s ?
size_type(strlen(s)) : 0) {}
36 : dat(s), siz(len) {
if (!dat) assert(siz == 0); }
38 : dat(first), siz(last - first) {
if (!dat) assert(siz == 0); }
56 bool empty()
const {
return siz == 0; }
66 char front()
const {
return *dat; }
67 char back()
const {
return *(dat + siz - 1); }
68 const char*
data()
const {
return dat; }
72 std::string
str()
const;
unsigned fast_stou(string_ref s)
bool operator<(string_ref x, string_ref y)
string_ref(const char *first, const char *last)
size_type find_last_of(string_ref s) const
bool ends_with(string_ref x) const
const_reverse_iterator rend() const
bool operator==(string_ref x, string_ref y)
void remove_suffix(size_type n)
This class implements a subset of the proposal for std::string_ref (proposed for the next c++ standar...
const_iterator end() const
int compare(string_ref x) const
std::string operator+(string_ref x, string_ref y)
const_iterator begin() const
const char * data() const
void remove_prefix(size_type n)
bool starts_with(string_ref x) const
const_reverse_iterator rbegin() const
std::ptrdiff_t difference_type
static const size_type npos
string_ref substr(size_type pos, size_type n=npos) const
string_ref(const string_ref &s)
string_ref & operator=(const string_ref &rhs)
size_type rfind(string_ref s) const
bool operator!=(string_ref x, string_ref y)
string_ref(const char *s, size_type len)
string_ref(const char *s)
bool operator<=(string_ref x, string_ref y)
const char * const_iterator
bool operator>=(string_ref x, string_ref y)
std::reverse_iterator< const_iterator > const_reverse_iterator
bool operator>(string_ref x, string_ref y)
size_type find_first_of(string_ref s) const
string_ref(const std::string &s)
char operator[](size_type i) const
std::ostream & operator<<(std::ostream &os, string_ref s)
size_type find(string_ref s) const