Summary
In this short episode, Jason introduces std::quoted, an underappreciated utility function added in C++14 that handles the proper quoting and escaping of strings. He demonstrates how std::quoted automatically adds quotation marks around strings and escapes any quotation marks within the string itself. This utility is particularly useful when generating output for systems like SQL where proper string escaping is essential. Jason also mentions that std::quoted works bidirectionally, allowing for unescaping of quoted strings as well.
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[diff.cpp23.strings]57% match -
[diff.cpp03.strings]57% match -
[diff.cpp17.input.output]48% match -
[filesystems]40% match -
[istringstream]40% match -
[ostream.manip]40% match