summaryrefslogtreecommitdiff
path: root/devdocs/gcc~13/c_002b_002b-concepts.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/gcc~13/c_002b_002b-concepts.html')
-rw-r--r--devdocs/gcc~13/c_002b_002b-concepts.html23
1 files changed, 23 insertions, 0 deletions
diff --git a/devdocs/gcc~13/c_002b_002b-concepts.html b/devdocs/gcc~13/c_002b_002b-concepts.html
new file mode 100644
index 00000000..f8fbb16e
--- /dev/null
+++ b/devdocs/gcc~13/c_002b_002b-concepts.html
@@ -0,0 +1,23 @@
+<div class="section-level-extent" id="C_002b_002b-Concepts"> <div class="nav-panel"> <p> Next: <a href="deprecated-features" accesskey="n" rel="next">Deprecated Features</a>, Previous: <a href="type-traits" accesskey="p" rel="prev">Type Traits</a>, Up: <a href="c_002b_002b-extensions" accesskey="u" rel="up">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div> <h1 class="section" id="C_002b_002b-Concepts-1"><span>7.10 C++ Concepts<a class="copiable-link" href="#C_002b_002b-Concepts-1"> ¶</a></span></h1> <p>C++ concepts provide much-improved support for generic programming. In particular, they allow the specification of constraints on template arguments. The constraints are used to extend the usual overloading and partial specialization capabilities of the language, allowing generic data structures and algorithms to be “refined” based on their properties rather than their type names. </p> <p>The following keywords are reserved for concepts. </p> <dl class="table"> <dt>
+<span><code class="code">assumes</code><a class="copiable-link" href="#index-assumes"> ¶</a></span>
+</dt> <dd>
+<p>States an expression as an assumption, and if possible, verifies that the assumption is valid. For example, <code class="code">assume(n &gt; 0)</code>. </p> </dd> <dt>
+<span><code class="code">axiom</code><a class="copiable-link" href="#index-axiom"> ¶</a></span>
+</dt> <dd>
+<p>Introduces an axiom definition. Axioms introduce requirements on values. </p> </dd> <dt>
+<span><code class="code">forall</code><a class="copiable-link" href="#index-axiom-1"> ¶</a></span>
+</dt> <dd>
+<p>Introduces a universally quantified object in an axiom. For example, <code class="code">forall (int n) n + 0 == n</code>). </p> </dd> <dt>
+<span><code class="code">concept</code><a class="copiable-link" href="#index-axiom-2"> ¶</a></span>
+</dt> <dd>
+<p>Introduces a concept definition. Concepts are sets of syntactic and semantic requirements on types and their values. </p> </dd> <dt>
+<span><code class="code">requires</code><a class="copiable-link" href="#index-requires"> ¶</a></span>
+</dt> <dd><p>Introduces constraints on template arguments or requirements for a member function of a class template. </p></dd> </dl> <p>The front end also exposes a number of internal mechanism that can be used to simplify the writing of type traits. Note that some of these traits are likely to be removed in the future. </p> <dl class="first-deftypefn"> <dt class="deftypefn" id="index-_005f_005fis_005fsame">
+<span class="category-def">Built-in Function: </span><span><code class="def-type">bool</code> <strong class="def-name">__is_same</strong> <code class="def-code-arguments">(<var class="var">type1</var>, <var class="var">type2</var>)</code><a class="copiable-link" href="#index-_005f_005fis_005fsame"> ¶</a></span>
+</dt> <dd><p>A binary type trait: <code class="code">true</code> whenever the <var class="var">type1</var> and <var class="var">type2</var> refer to the same type. </p></dd>
+</dl> </div> <div class="nav-panel"> <p> Next: <a href="deprecated-features">Deprecated Features</a>, Previous: <a href="type-traits">Type Traits</a>, Up: <a href="c_002b_002b-extensions">Extensions to the C++ Language</a> [<a href="index#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="indices" title="Index" rel="index">Index</a>]</p> </div><div class="_attribution">
+ <p class="_attribution-p">
+ &copy; Free Software Foundation<br>Licensed under the GNU Free Documentation License, Version 1.3.<br>
+ <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Concepts.html" class="_attribution-link">https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/C_002b_002b-Concepts.html</a>
+ </p>
+</div>