I have a file module.hpp
struct ModuleBase {
virtual void run() = 0;
};
and a main.cpp
program
int main() {
cout << ...?...; // here should go the contents of module.hpp
}
What can I put at ...?...
to let the contents of the header file printed here?
A basic idea would be
int main() {
static const string content = R"(
#include <module.hpp>
)";
cout << content;
}
but multi-line-strings are only available in C++11, and #include
does not work inside multi-line strings (which is good)?
If there is a non-portable way for the gcc... that would be a start.
Clarification (update): The substitution should be done at compile time.