Is there anything like this in Standard C++ / STL? Ideally it should be constructed like
fstring s = fstring(10);
I need to sometimes construct or have a string of fixed size. Sometimes to be able to read / write only that many characters into a stream.
Edit:
Note that the size is only known at runtime, and is different from one to the other. But all of the fstring
s should know how to work together and have all the fancy string
behavior.
With ISO C++ +17 you can do this
#include <string_view>
......
char dataBuffer[BUFF_SIZE];
auto commandString = std::string_view{ dataBuffer };
......
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With