问题描述
是否存在某种C ++库,其中包含代表C ++源代码的类?
当然应该能够将源代码输出到流中。
我正在寻找一种支持大多数C ++ 11功能并且还能够生成模板结构的东西。
Is there some sort of library for C++ which contains classes which represents C++ source code?It should of course be able to output the source code to a stream.I'm looking for something which supports most C++11 features and is also capable of generating templated constructions.
当我用google搜索时,我会我没有得到我想要的结果。不过,我敢肯定,有可用的东西。也许我只是使用了错误的术语。
When I google for this, I'm not getting the results I want. I'm sure though, that there is something available. Maybe I'm just using the wrong terms.
推荐答案
查看编译器,它使用支持实施IDE和其他需要处理AST的工具。 Clang完全支持所有C ++ 11功能(以及某些C ++ 1y功能)
Check out the Clang compiler which uses a library-based architecture to support implementing IDEs and other tools that need to process the AST. Clang fully supports all C++11 features (and some C++1y features)
更多信息,请参见。或在中其中描述了使用。
More information can be found in the Clang documentation. Or in this blog which describes basic source to source transformations using clang::Rewriter
.
这篇关于C ++ 11源代码生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!