[Glacier] Update String to be non-copyable by default.
This commit is contained in:
parent
ced89834de
commit
337126cabb
10 changed files with 39 additions and 42 deletions
|
|
@ -70,11 +70,6 @@ void StrFormatValue(StringBuilder& builder, StringView value, StringView opts) {
|
|||
StrFormatInternal(builder, value);
|
||||
}
|
||||
|
||||
template <>
|
||||
void StrFormatValue(StringBuilder& builder, String value, StringView opts) {
|
||||
StrFormatInternal(builder, value);
|
||||
}
|
||||
|
||||
void StrFormatInternal(StringBuilder& builder, StringView format) {
|
||||
// TODO: Consider throwing an error if there are unhandled format
|
||||
builder.PushBack(format);
|
||||
|
|
|
|||
|
|
@ -37,9 +37,6 @@ void StrFormatValue(StringBuilder& builder, const char* value, StringView opts);
|
|||
template <>
|
||||
void StrFormatValue(StringBuilder& builder, StringView value, StringView opts);
|
||||
|
||||
template <>
|
||||
void StrFormatValue(StringBuilder& builder, String value, StringView opts);
|
||||
|
||||
void StrFormatInternal(StringBuilder& builder, StringView format);
|
||||
|
||||
template <typename T, typename... Args>
|
||||
|
|
|
|||
|
|
@ -46,5 +46,6 @@ char String::operator[](uint64_t offset) const {
|
|||
}
|
||||
|
||||
String::operator StringView() const { return StringView(cstr_, length_); }
|
||||
StringView String::view() const { return this->operator StringView(); }
|
||||
|
||||
} // namespace glcr
|
||||
|
|
|
|||
|
|
@ -13,13 +13,17 @@ class String {
|
|||
String(const char* cstr, uint64_t str_len);
|
||||
String(StringView str);
|
||||
|
||||
String(const String&) = delete;
|
||||
|
||||
const char* cstr() const { return cstr_; }
|
||||
uint64_t length() const { return length_; }
|
||||
|
||||
bool operator==(const String& str);
|
||||
|
||||
char operator[](uint64_t offset) const;
|
||||
|
||||
operator StringView() const;
|
||||
StringView view() const;
|
||||
|
||||
private:
|
||||
char* cstr_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue