Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent C++ macro to Rust's include_str

Tags:

c++

rust

Does C++ have a macro like Rust's include_str!? Macros similar to include! or include_bytes would also meet my requirements.

like image 776
batthomas Avatar asked Oct 30 '20 13:10

batthomas


1 Answers

There's no standard way to do this. There's proposal P1040R6 for std::embed.

If you want to experiment with this right now, check out https://github.com/ThePhD/embed (which is by the author of the aforementioned proposal). You'll need to patch your compiler though, so it doesn't seem very portable.

like image 192
AVH Avatar answered Nov 16 '22 05:11

AVH