add some methods to windows gd::string

This commit is contained in:
matcool 2023-08-27 13:49:32 -03:00
parent 196ab7bb19
commit 7139ac4dcc
No known key found for this signature in database
GPG key ID: BF58756086D7AB1C

View file

@ -118,9 +118,25 @@ namespace gd {
return m_data.m_length; return m_data.m_length;
} }
bool operator<(const gd::string& other) const {
return std::string_view(this->c_str(), this->size()) < std::string_view(other.c_str(), other.size());
}
bool empty() const {
return this->size() == 0;
}
operator bool() const {
return !this->empty();
}
operator std::string() const { operator std::string() const {
return std::string(this->c_str(), this->size()); return std::string(this->c_str(), this->size());
} }
operator std::string_view() const {
return std::string_view(this->c_str(), this->size());
}
}; };
template <class T> template <class T>