« first day (1698 days earlier)      last day (1138 days later) » 

8:24 PM
Hello I want to ask - is it possible to have a sub-view of a string that is modifiable so I can replace it with something else later reflecting the changes in the original string that the view is of
 
1 message moved from Lounge<C++>
 
sure it's possible. But if you want to just use the stuff in the standard library, then you will have to stick to fixed-size views into the string
 
I don't mind a fixed view in the string - as long as I can replace it with a variable sized one
reflecting the change in the original string
 
nah, if you stick with std::string_view, then you can't make it longer or shorter
 
OK so boost then or ranges-v3 - what library should I use?
 
8:31 PM
I'm sure that boost has some rope-like type you could use
 
For many string manipulation application you'll need to grow or expand the string especially when working with weird encodings. For example, turkish upper vs lower case i. Ultimately, you should just recompose the string using a placeholder. AKA fmt::format_to("foo{}something",whatever);
 
Is it worth posting a question about it - in the main site?
 
Not really, your looking to some kind of wildcard insertion which is part of every string formatting library. But finding a string inside another string has been answered millions of times.
 
Actually is a match table in a long string (source file) - I construct views from start and end index and will be nice to have the option to modify the original string
I already employ the wildcard in the form of pcre2 - wrapped with STL
 
well if you have a long string of characters that you modify in length then maybe storing all of it in a std::string is the wrong structure. Since changing the length is not that efficient, storage or runtime-wise
 
8:52 PM
I posted anyway
 
how do you typically acess/use the full view? Is it just to save/load it?
 
I originally used a string to read the matches but recently I have the need to also replace - since they are constructed from a contigous string with indices, and never overlap I figured there may be some container to create a modifiable view instead of a string copy
Here is the question - you can see my original implementation in full - stackoverflow.com/questions/66499474/…
 

« first day (1698 days earlier)      last day (1138 days later) »