C++26: string and string_view improvements -- Sandor Dargo
Let’s continue our exploration of C++26 improvements. Today we focus on
string_view. Some types got new constructors accepting string_views, and concatenation of strings and string_views just got easier.
C++26: string and string_view improvements
by Sandor Dargo
From the article:
But let’s start with a brief reminder of what a
string_viewis.Reminder: the role of
string_view
std::string_viewwas introduced in C++17 and its purpose is to provide read-only access to a string-like object. It can often replaceconst string¶meters and offers a significant performance gain. It’s generally advisable to use it whenever you’d pass an immutable string-like input that you cannot move from source to target.We covered the topic earlier in more depth here.
P2495R3: Interfacing
stringstreams withstring_viewA
stringstreamis a good old tool for dealing with operations on string-based streams. While C++23 introducedspanstreams, due to fundamental semantic differences,stringstreams are not dead and it’s important to maintain them.Being a good old tool also means they predate
string_view. Given the available set of constructors, if you want to initialize astringstreamfrom astring_view, you first have to manually convert it into astring.P2495R3 fixes this by adding new constructors accepting
string_views.It’s worth noting that this is a purely additive library change — it doesn’t break existing code.
At the moment of publication, this change is already available on Clang 19.

Registration is now open for CppCon 2026! The conference starts on September 12 and will be held
GCC 16 is about to be released, so I'm sharing some of the new features I worked on this year. Some changes are visible to users, while others improve the system more subtly.
Registration is now open for CppCon 2026! The conference starts on September 12 and will be held
Registration is now open for CppCon 2026! The conference starts on September 12 and will be held
Registration is now open for CppCon 2026! The conference starts on September 12 and will be held 