mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2025-05-02 13:47:56 +02:00
Added copy assignment operator to string.
This commit is contained in:
parent
37ae4faa29
commit
3ae9ae5127
@ -604,6 +604,14 @@ bool operator!=(std::string &b, const String &a) {
|
|||||||
return !(a == b);
|
return !(a == b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String& String::operator=(const String &other) {
|
||||||
|
clear();
|
||||||
|
|
||||||
|
append_str(other);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
String::String() {
|
String::String() {
|
||||||
_data = nullptr;
|
_data = nullptr;
|
||||||
_actual_size = 0;
|
_actual_size = 0;
|
||||||
@ -695,5 +703,6 @@ String::String(const std::string &str) {
|
|||||||
String::~String() {
|
String::~String() {
|
||||||
if (_data) {
|
if (_data) {
|
||||||
delete[] _data;
|
delete[] _data;
|
||||||
|
_data = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,8 @@ public:
|
|||||||
operator std::string() { return to_string(); }
|
operator std::string() { return to_string(); }
|
||||||
operator std::string() const { return to_string(); }
|
operator std::string() const { return to_string(); }
|
||||||
|
|
||||||
|
String& operator=(const String &other);
|
||||||
|
|
||||||
String();
|
String();
|
||||||
String(const String &other);
|
String(const String &other);
|
||||||
String(const String &other, const int grow_by);
|
String(const String &other, const int grow_by);
|
||||||
|
Loading…
Reference in New Issue
Block a user