Nov 6, 2024

[C++] include from /dev/stdin

When I was publishing Concurrent LRUCache which is used by my previous job at Linkedin, I used this feature provided by godbolt for demo, which is it could include headers through https protocol. 
e.g: https://godbolt.org/z/Y6he8z9Gf

Turned out this feature can be done through #include "/dev/stdin"

#include "/dev/stdin"

int main(){
  foo f{};
  (void)(f);
}

$ echo "struct foo {};" | clang++ -std=c++20 main.cc -Wall

Just replace the echo part with `wget`

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.