如何使用 C++ 概念(“concepts lite")支持构建 gcc? [英] How do I build gcc with C++ concepts ("concepts lite") support?

查看:30
本文介绍了如何使用 C++ 概念(“concepts lite")支持构建 gcc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C++ 标准委员会正在制定概念扩展的 TS(技术规范):编程语言 - 概念的 C++ 扩展".N4377 是最新版本文档.为了包含在 C++ 标准中,要求实现功能,理想情况下是可公开访问的系统.

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++-conceptsgccgit 镜像,但没有编译.如何构建和使用上述 [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?

推荐答案

根据 Andrew Sutton 的说法,Concepts Lite 工作的 git 镜像已完全过时,不应使用.gcc 实现concepts-lite"的 svn 存储库中有一个概念分支(有一个 pre-C++11 向 C++ 添加概念的努力已被放弃;使用名称概念精简版开始向 C++ 添加概念的新努力).构建起来相当简单(假设您已经安装了最近的 gcc 及其依赖的软件包;请参阅 gcc 安装说明了解您可能想要传递的其他选项:以下说明对我有用,除了我明确指出 配置gmp, mpcmpfr 已安装):

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.org/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

不完全清楚的是如何实际使用 概念:选项-fconcepts 确实存在,但似乎无条件地做一些不同于启用concepts-lite 的事情.相反,在启用概念的情况下进行编译时,您将使用 -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++ 概念(“concepts lite")支持构建 gcc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆