vendredi 6 décembre 2019

Trimming C++ string in constant time

Is there a STL/library method to reduce the string size (trim it) in constant time.

In C this this can be done in constant time by just adding the '\0' past the last index.

C++ resize compexity is undefined and mostly likely be O(N)

http://www.cplusplus.com/reference/string/string/resize/

Aucun commentaire:

Enregistrer un commentaire