Strings in Constant Expressions
Now, we'll learn why string_view works with constant expressions.
The interesting property of string_view
is that all of the methods are marked as constexpr
(except for copy
, operator <<
and std::hash
functions specialised for string views). With this capability, you can work on strings at compile time.
For example:
Get hands-on with 1200+ tech skills courses.