14 return siz ? string(dat, siz)
24 if (
int r = memcmp(dat, rhs.dat,
std::min(siz, rhs.siz))) {
28 return int(siz - rhs.siz);
46 if (s.
empty())
return 0;
47 if (s.
size() <= siz) {
48 auto m = siz - s.
size();
49 for (
size_type pos = 0; pos <= m; ++pos) {
50 if ((dat[pos] == s[0]) &&
51 std::equal(s.
begin() + 1, s.
end(), dat + pos + 1)) {
61 auto it = std::find(
begin(),
end(), c);
68 if (s.
empty())
return siz;
69 if (s.
size() <= siz) {
70 auto m = siz - s.
size();
71 for (
auto pos = m; pos !=
size_type(-1); --pos) {
72 if ((dat[pos] == s[0]) &&
73 std::equal(s.
begin() + 1, s.
end(), dat + pos + 1)) {
118 return (siz >= x.
size()) &&
119 (memcmp(dat, x.
data(), x.
size()) == 0);
128 return (siz >= x.
size()) &&
129 (memcmp(dat + siz - x.
size(), x.
data(), x.
size()) == 0);
149 unsigned d = c -
'0';
151 throw std::invalid_argument(
"fast_stoi");
165 result.reserve(x.
size() + y.
size());
173 result.reserve(1 + y.
size());
174 result.append(&x, 1);
181 result.reserve(x.
size() + 1);
183 result.append(&y, 1);
size_type find_last_of(string_ref s) const
bool ends_with(string_ref x) const
vecN< N, T > min(const vecN< N, T > &x, const vecN< N, T > &y)
const_reverse_iterator rend() const
bool operator<(string_ref x, string_ref y)
This class implements a subset of the proposal for std::string_ref (proposed for the next c++ standar...
const_iterator end() const
std::ostream & operator<<(std::ostream &os, string_ref s)
int compare(string_ref x) const
const_iterator begin() const
const char * data() const
bool starts_with(string_ref x) const
const_reverse_iterator rbegin() const
string operator+(string_ref x, string_ref y)
unsigned fast_stou(string_ref s)
static const size_type npos
string_ref substr(size_type pos, size_type n=npos) const
size_type rfind(string_ref s) const
size_type find_first_of(string_ref s) const
size_type find(string_ref s) const