Jump to content

C++: Difference between revisions

363 bytes added ,  17 October 2023
Line 119: Line 119:
Strings are mutable in C++.<br>
Strings are mutable in C++.<br>
I typically use <code>+</code> or <code>ostringstream</code> to build strings.
I typically use <code>+</code> or <code>ostringstream</code> to build strings.
====std::string_view====
[https://en.cppreference.com/w/cpp/string/basic_string_view std::basic_string_view]
This is useful for writing functions which accept anything that looks like a string such as substrings, since typically <code>string::substr</code> performs a copy.
Note that <code>std::string_view</code> is <code>std::basic_string_view<char></code>.


===Filesystem===
===Filesystem===