std::quoted and the “friendly” delimiters

Syntax

std::quoted was added in C++14 and it is used to take care of escaping quotes and backslashes in output streams, and unescaping them in input streams. This is handy for example if we want to use it in an SQL statement, in both ways (either add the escaping, or remove them automatically).

It is included in the iomanip header, as it is an IO manipulator.

 

Below you will find a full example in which we add the escape characters and use the same function to remove them afterwards.

 

You may also like...

Leave a Reply