: buf(0), len(0), used(0), refs(1)! {! reserve(max(other.len, n));! copy(other.buf, other.buf + other.used, buf);! used = other.used;! }! ! void String::about_to_modify(size_t n, bool unshareable /* = false */) {! if (data->refs > 1 && data->refs != Unshareable) {! StringBuf *newdata = new StringBuf(*data, n);! --data->refs;! data = newdata;! } else {! data->reserve(n);! }! ! data->refs = unshareable ? Unshareable : 1;! }! ! char &String::operator[](size_t n) {! about_to_modify(data->len, true);! ! return *(data_->buf+n);! }