Hello all,
I've recently been writing a text input field with SDL, It is nearly complete now, but I was hoping I could have your opinion on this one particular aspect.
I am currently using a std::vector<string> to hold input data from the keyboard (text). Basically the way it works is that every index of the vector represents a singular line.
However the requirements for this container make it difficult to choose if another container for the strings would be more efficient. The function that is called when a lines wrap is needed, and also when the user presses enter/return, must use a vector::emplace() (which I understand is inefficient when you have many elements that come after).
Under these conditions, is a vector the best choice? I know a list would be more efficient for inserting elements into the middle of, but also most of the string elements added will probably be added to the end.
I know the general usages for the container types in the STL, but the requirements for this are such that it seems like I'm giving up something whichever way I go.
What do you think? Thanks ☺