RogerioY / starshatter-open

Automatically exported from code.google.com/p/starshatter-open
0 stars 0 forks source link

We should restrict the set of operations that the Text class can do #2

Open RogerioY opened 5 years ago

RogerioY commented 5 years ago

I've made the decision to solve the string related build warnings by making use of the same handwound Text class used by GUI code. I think there some potentially wasteful methods on the Text class which we can restrict without losing a lot of flexibility.

RogerioY commented 5 years ago

An example of such a change is: // indexing char operator[](int index) const; char operator()(int index) const; char& operator[](int index); char& operator()(int index); goes to.. // indexing char operator[](int index) const; char operator()(int index) const; char& operator[](int index) = delete; char& operator()(int index) = delete; Where the return-by-reference methods perform memory allocations etc on the internal representations of the text data.

I am certain we make many unnecessary allocations per frame and I am compounding this issue by making more use of this class.