Added default move constructor and assignment operator for tstring.

Also, minor cleanup of methods.

PiperOrigin-RevId: 262564087
This commit is contained in:
Dero Gharibian 2019-08-09 08:25:51 -07:00 committed by TensorFlower Gardener
parent ede03c7827
commit a79c52ed09

View File

@ -49,9 +49,9 @@ class tstring {
std::string str_;
public:
tstring() : str_() {}
tstring() = default;
tstring(const tstring& str) = default;
tstring(const tstring&) = default;
tstring(const std::string& str) : str_(str) {}
@ -63,7 +63,9 @@ class tstring {
std::is_same<T, absl::string_view>::value, T>>
explicit tstring(const T& str) : str_(str.data(), str.size()) {}
~tstring() {}
tstring(tstring&&) noexcept = default;
~tstring() = default;
tstring& operator=(const tstring& str) = default;
@ -87,6 +89,8 @@ class tstring {
return *this;
}
tstring& operator=(tstring&&) noexcept = default;
bool operator<(const tstring& o) const { return str_ < o.str_; }
bool operator>(const tstring& o) const { return str_ > o.str_; }