3 ms·
Because most projects involve interfacing with other third-party libraries that will undoubtedly not know about this other third-party library that implements a
by kelnos 6y ago
Because most projects involve interfacing with other third-party libraries that will undoubtedly not know about this other third-party library that implements a nice string.
- kaba0 6y agoIt can contain a to_cstring() function and problem solved. If it uses a struct with length of string and pointer to a c-style string, even the conversion can be elided (at the price of some inflexibility/unnecessary copying while in use)
- kelnos 6y agoThat would mean you lose the ability to do all sorts of optimizations and memory sharing. Or at least, you can do them, but then the c_string() function requires copying the data. And that also means that it's a one-way thing: you can't use the copy on something that wants to modify the string, and expect your FancyString instance to reflect the modification.