Reduce String CoW

By introducing an intermediate proxy class for the array subscript
operator for String and CharString we can control better when CowData
will actually CoW.

This should improve performance of String usage for most cases.
This commit is contained in:
Hein-Pieter van Braam 2018-12-16 00:44:18 +00:00
parent 7ac67bfec1
commit 4e25e5066b
8 changed files with 44 additions and 13 deletions

View file

@ -74,7 +74,7 @@ void GDAPI godot_string_new_with_wide_string(godot_string *r_dest, const wchar_t
memnew_placement(dest, String(p_contents, p_size));
}
wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx) {
const wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx) {
String *self = (String *)p_self;
return &(self->operator[](p_idx));
}