want to write scripts in C++? sure you do.
put c-run
in your path, then you can write scripts in C++ (or in C).
#!/usr/bin/env c-run
#include <iostream>
int main() {
std::cout << "hello world\n";
}
and here is how it works...
$ hello-world.cpp
hello world
Note that running hello-world.cpp
will compile the "script" the first time, and store it in ~/.cache/c-run
.
On subsequent invocation, c-run
will check the timestamps and will not rebuild the "script" if it has not changed.