string fixes

master
Daniel Kolesa 2015-07-18 17:01:11 +01:00
parent 53e292cdb0
commit d7c789195a
1 changed files with 8 additions and 1 deletions

View File

@ -303,7 +303,7 @@ public:
p_cap = v.p_cap;
p_buf.~StrPair();
new (&p_buf) StrPair(v.disown(), move(v.p_buf.second()));
if (!p_cap) p_buf.first() = &p_len;
if (!p_cap) p_buf.first() = (Pointer)&p_len;
return *this;
}
StringBase &operator=(const Value *v) {
@ -383,6 +383,13 @@ public:
bool empty() const { return (size() == 0); }
Value *disown() {
Pointer r = p_buf.first();
p_buf.first() = nullptr;
p_len = p_cap = 0;
return (Value *)r;
}
void push(T v) {
reserve(p_len + 1);
p_buf.first()[p_len++] = v;