问题描述
C ++标准委员会正在致力于概念扩展的TS(技术规范):编程语言 - 概念的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.
我知道,但上述概念提案(通俗地称为 Concepts Lite )是不同的。我听说有一个概念分支,我尝试了来自的 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存储库中有一个概念分支,用于实现concepts-lite(有一个前C ++ 11努力添加概念到C ++被放弃;一个新的努力添加概念到C + +开始使用名称概念lite)。这是相当直接的构建(假设你已经有一个最近的gcc和包取决于安装;请参阅gcc安装说明其他选项,你可能想通过:下面的说明为我工作,除了我明确指出<$在,,并安装了):
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
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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!