forked from OctaForge/libostd
no need to specify template args there
This commit is contained in:
parent
f9adf08ef9
commit
6b87f4c4ac
|
@ -183,19 +183,19 @@ public:
|
||||||
|
|
||||||
void clear() { p_buf.clear(); }
|
void clear() { p_buf.clear(); }
|
||||||
|
|
||||||
StringBase<T> &operator=(const StringBase &v) {
|
StringBase &operator=(const StringBase &v) {
|
||||||
p_buf.operator=(v);
|
p_buf.operator=(v);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
StringBase<T> &operator=(StringBase &&v) {
|
StringBase &operator=(StringBase &&v) {
|
||||||
p_buf.operator=(octa::move(v));
|
p_buf.operator=(octa::move(v));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
StringBase<T> &operator=(const T *v) {
|
StringBase &operator=(const T *v) {
|
||||||
p_buf = ConstRange(v, strlen(v) + 1);
|
p_buf = ConstRange(v, strlen(v) + 1);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
StringBase<T> &operator=(const Range &r) {
|
StringBase &operator=(const Range &r) {
|
||||||
p_buf = r;
|
p_buf = r;
|
||||||
terminate();
|
terminate();
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -241,13 +241,13 @@ public:
|
||||||
p_buf.push('\0');
|
p_buf.push('\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBase<T> &append(const StringBase &s) {
|
StringBase &append(const StringBase &s) {
|
||||||
p_buf.pop();
|
p_buf.pop();
|
||||||
p_buf.insert_range(p_buf.size(), s.p_buf.each());
|
p_buf.insert_range(p_buf.size(), s.p_buf.each());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBase<T> &append(const StringBase &s, octa::Size idx, octa::Size len) {
|
StringBase &append(const StringBase &s, octa::Size idx, octa::Size len) {
|
||||||
p_buf.pop();
|
p_buf.pop();
|
||||||
p_buf.insert_range(p_buf.size(), Range(&s[idx],
|
p_buf.insert_range(p_buf.size(), Range(&s[idx],
|
||||||
(len == npos) ? (s.size() - idx) : len));
|
(len == npos) ? (s.size() - idx) : len));
|
||||||
|
@ -255,14 +255,14 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBase<T> &append(const T *s) {
|
StringBase &append(const T *s) {
|
||||||
p_buf.pop();
|
p_buf.pop();
|
||||||
p_buf.insert_range(p_buf.size(), ConstRange(s,
|
p_buf.insert_range(p_buf.size(), ConstRange(s,
|
||||||
strlen(s) + 1));
|
strlen(s) + 1));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBase<T> &append(octa::Size n, T c) {
|
StringBase &append(octa::Size n, T c) {
|
||||||
p_buf.pop();
|
p_buf.pop();
|
||||||
for (octa::Size i = 0; i < n; ++i) p_buf.push(c);
|
for (octa::Size i = 0; i < n; ++i) p_buf.push(c);
|
||||||
p_buf.push('\0');
|
p_buf.push('\0');
|
||||||
|
@ -270,20 +270,20 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename R>
|
template<typename R>
|
||||||
StringBase<T> &append_range(R range) {
|
StringBase &append_range(R range) {
|
||||||
p_buf.pop();
|
p_buf.pop();
|
||||||
p_buf.insert_range(p_buf.size(), range);
|
p_buf.insert_range(p_buf.size(), range);
|
||||||
terminate();
|
terminate();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBase<T> &operator+=(const StringBase &s) {
|
StringBase &operator+=(const StringBase &s) {
|
||||||
return append(s);
|
return append(s);
|
||||||
}
|
}
|
||||||
StringBase<T> &operator+=(const T *s) {
|
StringBase &operator+=(const T *s) {
|
||||||
return append(s);
|
return append(s);
|
||||||
}
|
}
|
||||||
StringBase<T> &operator+=(T c) {
|
StringBase &operator+=(T c) {
|
||||||
p_buf.pop();
|
p_buf.pop();
|
||||||
p_buf.push(c);
|
p_buf.push(c);
|
||||||
p_buf.push('\0');
|
p_buf.push('\0');
|
||||||
|
|
Loading…
Reference in a new issue