mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2025-04-20 01:43:12 +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);
|
||||
}
|
||||
|
||||
String& String::operator=(const String &other) {
|
||||
clear();
|
||||
|
||||
append_str(other);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
String::String() {
|
||||
_data = nullptr;
|
||||
_actual_size = 0;
|
||||
@ -695,5 +703,6 @@ String::String(const std::string &str) {
|
||||
String::~String() {
|
||||
if (_data) {
|
||||
delete[] _data;
|
||||
_data = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -97,6 +97,8 @@ public:
|
||||
operator std::string() { return to_string(); }
|
||||
operator std::string() const { return to_string(); }
|
||||
|
||||
String& operator=(const String &other);
|
||||
|
||||
String();
|
||||
String(const String &other);
|
||||
String(const String &other, const int grow_by);
|
||||
|
Loading…
Reference in New Issue
Block a user