I have a question about compile-time vs. runtime string literals in C++. At compile time, creating a string literal and passing (for example) to a regexp processor
std::string pattern = "a\\d+"
results in a "post-compiled" literal sequence of chars 'a' '\' 'd' '+' '\0'
At runtime, a user provides this same "literal string" of characters through a command-line interface, by typing (for example)
set pattern 'a\\d+'
and this result in the "literal" sequence of chars 'a' '\' '\' 'd' '+' '\0'
Is there any way to use or leverage the mechanism C++ uses to convert "compile-time" representations of strings into the actual C++ string representation where escapes have been processed correctly?