Simpilfy MutableSlice constructor (behavior is defined since C++11).

GitOrigin-RevId: 77c07d8abc0b6c10f24e95f61811fe6d5ca3af58
This commit is contained in:
levlam 2018-10-25 18:10:14 +03:00
parent 5368c96a41
commit 570a59f1d4

View File

@ -26,11 +26,7 @@ inline MutableSlice::MutableSlice(unsigned char *s, size_t len) : s_(reinterpret
CHECK(s_ != nullptr); CHECK(s_ != nullptr);
} }
inline MutableSlice::MutableSlice(string &s) : MutableSlice() { inline MutableSlice::MutableSlice(string &s) : s_(&s[0]), len_(s.size()) {
if (!s.empty()) {
s_ = &s[0];
len_ = s.size();
}
} }
template <class T> template <class T>