diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2021-09-30 23:02:41 +0200 | 
|---|---|---|
| committer | Rémi Verschelde <rverschelde@gmail.com> | 2021-09-30 23:06:40 +0200 | 
| commit | cc57cbb73a4675f8b51e6cf4a77f0f9d814d4b01 (patch) | |
| tree | be3fa9f52a4f3b5daba0403f8a106b5975874981 /core | |
| parent | 770bd61767b179127a6a8ff227a09c68c679f8fd (diff) | |
CharProxy: Add copy constructor
Adding the copy constructor is needed to solve a `-Wdeprecated-copy` warning
from GCC and Clang, which is raised when upgrading doctest from 2.4.4 to 2.4.6.
Diffstat (limited to 'core')
| -rw-r--r-- | core/string/ustring.h | 16 | 
1 files changed, 10 insertions, 6 deletions
diff --git a/core/string/ustring.h b/core/string/ustring.h index 24da6b82af..1d80ccf58d 100644 --- a/core/string/ustring.h +++ b/core/string/ustring.h @@ -51,11 +51,15 @@ class CharProxy {  	CowData<T> &_cowdata;  	static const T _null = 0; -	_FORCE_INLINE_ CharProxy(const int &p_index, CowData<T> &cowdata) : +	_FORCE_INLINE_ CharProxy(const int &p_index, CowData<T> &p_cowdata) :  			_index(p_index), -			_cowdata(cowdata) {} +			_cowdata(p_cowdata) {}  public: +	_FORCE_INLINE_ CharProxy(const CharProxy<T> &p_other) : +			_index(p_other._index), +			_cowdata(p_other._cowdata) {} +  	_FORCE_INLINE_ operator T() const {  		if (unlikely(_index == _cowdata.size())) {  			return _null; @@ -68,12 +72,12 @@ public:  		return _cowdata.ptr() + _index;  	} -	_FORCE_INLINE_ void operator=(const T &other) const { -		_cowdata.set(_index, other); +	_FORCE_INLINE_ void operator=(const T &p_other) const { +		_cowdata.set(_index, p_other);  	} -	_FORCE_INLINE_ void operator=(const CharProxy<T> &other) const { -		_cowdata.set(_index, other.operator T()); +	_FORCE_INLINE_ void operator=(const CharProxy<T> &p_other) const { +		_cowdata.set(_index, p_other.operator T());  	}  };  |