std::string conversion operator for my string.

This commit is contained in:
Relintai 2021-11-01 00:32:02 +01:00
parent 2079d5bd6e
commit ad4e3bec3c
2 changed files with 5 additions and 2 deletions

View File

@ -433,7 +433,7 @@ uint32_t String::to_uint() {
return static_cast<uint32_t>(atoll(c_str()));
}
std::string String::to_string() {
std::string String::to_string() const {
return std::string(c_str());
}

View File

@ -58,7 +58,7 @@ public:
double to_double();
int to_int();
uint32_t to_uint();
std::string to_string();
std::string to_string() const;
char *c_str();
const char *c_str() const;
@ -94,6 +94,9 @@ public:
friend bool operator==(std::string &b, const String &a);
friend bool operator!=(std::string &b, const String &a);
operator std::string() { return to_string(); }
operator std::string() const { return to_string(); }
String();
String(const String &other);
String(const String &other, const int grow_by);