I'm string to create a std::regex(__FILE__)
as part of a unit test which checks some exception output that prints the file name.
On Windows it fails with:
regex_error(error_escape): The expression contained an invalid escaped character, or a trailing escape.
because the __FILE__
macro expansion contains un-escaped backslashes.
Is there a more elegant way to escape the backslashes than to loop through the resulting string (i.e. with a std
algorithm or some std::string
function)?
Aucun commentaire:
Enregistrer un commentaire