I intend to perform in-place modification of std::string with the help of a modifier function. In this regard, I looked up on internet and found that pass by pointer method is not recommended. I have few queries in this regard.
- If I pass a std::string to the function as pass by value, would it be considered as in-place modification if I don't create any new std::string in modifier function?
- What is the standard and efficient ethod to modify std::string in place?
- How to change the end of std::string? One way that I could think of is to assign '\0' to all the trailing characters of the string but it would be inefficient to do so if length of string is large.