14 return siz ? string(dat, siz)
24 if (
int r = memcmp(dat, x.dat,
std::min(siz, x.siz))) {
28 return int(siz - x.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)) {
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");
const char * data() const
auto find(InputRange &&range, const T &value)
bool starts_with(string_view x) const
size_type find_first_of(string_view s) const
bool operator<(string_view x, string_view y)
vecN< N, T > min(const vecN< N, T > &x, const vecN< N, T > &y)
size_type find_last_of(string_view s) const
bool ends_with(string_view x) const
static const size_type npos
int compare(string_view x) const
std::ostream & operator<<(std::ostream &os, string_view s)
size_type find(string_view s) const
size_type rfind(string_view s) const
This class implements a (close approximation) of the std::string_view class.
string_view substr(size_type pos, size_type n=npos) const
unsigned fast_stou(string_view s)