Rum*_*rak 11 c++ c++20 c++-modules compiler-explorer
为了在 C++20 中使用自编模块提出问题或演示错误/功能,能够使用Matt Godbolt 的编译器资源管理器会很棒。
例子:
test.cpp(模块测试):
export module test;
export template<typename T>
void do_something(const T&)
{
}
Run Code Online (Sandbox Code Playgroud)
编译 clang++ -std=c++20 -stdlib=libc++ -fmodules -c -Xclang -emit-module-interface -o test.pcm test.cpp
主.cpp:
import test;
int main() {
do_something(7);
}
Run Code Online (Sandbox Code Playgroud)
编译 clang++ -std=c++20 -stdlib=libc++ -fmodules -fimplicit-modules -fimplicit-module-maps -fprebuilt-module-path=. main.cpp
问:有没有办法用编译器资源管理器来做到这一点?