So to make a string in C++ raw you do
std::string raw = R"raw_string(text_here""n/whatever)raw_string"
but my question is can you make a macro that preprocesses the string ,
so its raw but it looks normal in code?? Like in a function argument
#define start_raw_string R"raw_string(
#define end_raw_string )raw_string"
void example(std::string raw_text){
std::cout << start_raw_string raw_text end_raw_string << std::endl;
// here all this ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ is
// an entire string ...
// equivalent to R"raw_string(<RAW_TEXT_HERE>)raw_string"
}
int main(){
example("text_here""n/whatever");
// will print >> text_here""n/whatever
}
as you can see by highlighting it will not work like this for sure
so any workaround? found something about macro glue-ing here
https://www.iar.com/knowledge/learn/programming/advanced-preprocessor-tips-and-tricks/
but tried it and cant get it to work... soo? it should be posibile because its not
compile-time.
std::stringis not "raw". The C-string literal is raw.R"(\n)"is barely bigger than"\\n". If you aren't using)then you don't need any delimiter.