我如何用C ++概念(“概念精简”)支持构建gcc?

编程入门 行业动态 更新时间:2024-10-28 11:23:14
本文介绍了我如何用C ++概念(“概念精简”)支持构建gcc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

C ++标准委员会正在致力于概念扩展的TS(技术规范):编程语言 - 概念的C + +扩展。 N4377 是本文档的最新版本。

The C++ standards committee is working on a TS (Technical Specification) for Concepts extension: "Programming Languages - C++ Extensions for Concepts". N4377 is the latest version of this document. For inclusion into the C++ standard features are asked to be implemented, ideally for a publicly accessible system.

我知道 concept-gcc ,但上述概念提案(通俗地称为 Concepts Lite )是不同的。我听说有一个概念分支,我尝试了来自 origin / asutton / c ++ - concepts > gcc 的 git 镜像,但没有编译。如何构建和使用上述[draft] TS中指定的gcc支持概念的版本?

I'm aware of concept-gcc but the concepts proposal above (colloquially referred to as Concepts Lite) is different. I heard that there is a concepts branch and I have tried the origin/asutton/c++-concepts from gcc's git mirror but that didn't compile. How do I build and use a version of gcc supporting concepts as specified in the above [draft] TS?

推荐答案

Sutton Concepts Lite工作的git镜像完全是过时的,不应该使用。在svn存储库中有一个概念分支,用于 gcc 实现concepts-lite(有一个前C ++ 11努力添加概念到C ++被放弃;一个新的努力添加概念到C + +开始使用名称概念lite)。这是相当直接的构建(假设你已经有一个最近的gcc和包取决于安装;请参阅gcc安装说明其他选项,你可能想通过:下面的说明为我工作,除了我明确指出<$在 gmp , configure 。 org / index.php?prog = mpc> mpc ,并安装了 mpfr ):

According to Andrew Sutton the git mirror of the Concepts Lite work is entirely out of date and shouldn't be used. There is a concepts branch in the svn repository for gcc implementing "concepts-lite" (there was a pre-C++11 effort to add concepts to C++ which was abandoned; a new effort to add concepts to C++ was started using the name concepts lite). It is fairly straight forward to build (assuming you already have a recent gcc and the packages it depends on installed; see the gcc install instruction for other options you might want to pass: the instructions below worked for me except that I explicitly pointed configure at the locations where gmp, mpc, and mpfr are installed):

cd <suitable-directory> svn checkout svn://gcc.gnu/svn/gcc/branches/c++-concepts mkdir build-concepts cd build-concepts ../c++-concepts/configure --prefix=<concept-gcc-root> --disable-bootstrap --enable-languages=c,c++ make -j8 make install

b $ b

什么并不完全明显是如何实际使用概念:选项 -fconcepts 确实存在,但似乎无条件做不同于启用概念 - 精简。相反,在启用概念的编译时,您可以使用 -std = c ++ 1z 选项。

What isn't entirely obvious is how to actually use concepts: the option -fconcepts does exist but seems to unconditionally do something different than enabling concepts-lite. Instead, you'd use the -std=c++1z option when compiling with concepts enabled.

更多推荐

我如何用C ++概念(“概念精简”)支持构建gcc?

本文发布于:2023-07-27 14:22:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1222835.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:概念   如何用   gcc

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!