mirror of
https://github.com/boostorg/concept_check.git
synced 2025-08-13 19:34:27 +02:00
1.19.0 runup
[SVN r8446]
This commit is contained in:
@@ -11,7 +11,9 @@
|
|||||||
-- purpose. It is provided "as is" without express or implied warranty.
|
-- purpose. It is provided "as is" without express or implied warranty.
|
||||||
-->
|
-->
|
||||||
<Head>
|
<Head>
|
||||||
<Title>Concept Checking</Title>
|
<Title>Concept Check Library</Title>
|
||||||
|
</head>
|
||||||
|
|
||||||
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||||
ALINK="#ff0000">
|
ALINK="#ff0000">
|
||||||
<IMG SRC="../../c++boost.gif"
|
<IMG SRC="../../c++boost.gif"
|
||||||
@@ -19,7 +21,7 @@
|
|||||||
|
|
||||||
<BR Clear>
|
<BR Clear>
|
||||||
|
|
||||||
<H1>The Boost Concept Checking Library (BCCL)</H1>
|
<H1>The Boost Concept Check Library (BCCL)</H1>
|
||||||
|
|
||||||
<h2>
|
<h2>
|
||||||
<A NAME="sec:concept-checking"></A>
|
<A NAME="sec:concept-checking"></A>
|
||||||
@@ -40,7 +42,7 @@ required concept as a hint to the user and to state the concept
|
|||||||
requirements in the documentation. However, often times the
|
requirements in the documentation. However, often times the
|
||||||
requirements are vague, incorrect, or nonexistent, which is quite a
|
requirements are vague, incorrect, or nonexistent, which is quite a
|
||||||
problem for the user, since he or she will not know exactly what kind
|
problem for the user, since he or she will not know exactly what kind
|
||||||
of input is expected by the template. Furthemore, the following
|
of input is expected by the template. Furthermore, the following
|
||||||
problems occur:
|
problems occur:
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
@@ -84,7 +86,7 @@ overhead. The main cost of using the mechanism is in compile-time.
|
|||||||
<p>
|
<p>
|
||||||
Any programmer writing class or function templates ought to make
|
Any programmer writing class or function templates ought to make
|
||||||
concept checking a normal part of their code-writing routine. A
|
concept checking a normal part of their code-writing routine. A
|
||||||
concept check should be inserted for each template paramter in a
|
concept check should be inserted for each template parameter in a
|
||||||
component's public interface. If the concept is one of the ones from
|
component's public interface. If the concept is one of the ones from
|
||||||
the Standard Library, then simply use the matching concept checking
|
the Standard Library, then simply use the matching concept checking
|
||||||
class in the BCCL. If not, then write a new concept checking class -
|
class in the BCCL. If not, then write a new concept checking class -
|
||||||
@@ -102,7 +104,7 @@ The documentation is organized into the following sections.
|
|||||||
<LI><a href="#publications">Publications</a></LI>
|
<LI><a href="#publications">Publications</a></LI>
|
||||||
<LI><a href="#acknowledgements">Acknowledgements</a></LI>
|
<LI><a href="#acknowledgements">Acknowledgements</a></LI>
|
||||||
<LI><a href="./using_concept_check.htm">Using Concept Checks</a></LI>
|
<LI><a href="./using_concept_check.htm">Using Concept Checks</a></LI>
|
||||||
<LI><a href="./creating_concept_checks.htm">Creating Concept Checking Classes</a></LI>
|
<LI><a href="creating_concepts.htm">Creating Concept Checking Classes</a></LI>
|
||||||
<LI><a href="./concept_covering.htm">Concept Covering and Archetypes</a></LI>
|
<LI><a href="./concept_covering.htm">Concept Covering and Archetypes</a></LI>
|
||||||
<LI><a href="./prog_with_concepts.htm" ">Programming With Concepts</a></LI>
|
<LI><a href="./prog_with_concepts.htm" ">Programming With Concepts</a></LI>
|
||||||
<LI><a href="./implementation.htm">Implementation</a></LI>
|
<LI><a href="./implementation.htm">Implementation</a></LI>
|
||||||
@@ -157,9 +159,9 @@ We present a simple example to illustrate incorrect usage of a
|
|||||||
template library and the resulting error messages. In the code below,
|
template library and the resulting error messages. In the code below,
|
||||||
the generic <tt>std::stable_sort()</tt> algorithm from the Standard
|
the generic <tt>std::stable_sort()</tt> algorithm from the Standard
|
||||||
Template Library (STL)[<a
|
Template Library (STL)[<a
|
||||||
href="bibliography.html#austern99:_gener_progr_stl">3</a>, <a
|
href="bibliography.htm#austern99:_gener_progr_stl">3</a>, <a
|
||||||
href="bibliography.html#IB-H965502">4</a>,<a
|
href="bibliography.htm#IB-H965502">4</a>,<a
|
||||||
href="bibliography.html#stepa.lee-1994:the.s:TR">5</a>] is applied to
|
href="bibliography.htm#stepa.lee-1994:the.s:TR">5</a>] is applied to
|
||||||
a linked list.
|
a linked list.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
@@ -168,7 +170,7 @@ a linked list.
|
|||||||
2 #include <algorithm>
|
2 #include <algorithm>
|
||||||
3
|
3
|
||||||
4 struct foo {
|
4 struct foo {
|
||||||
5 bool operator<(const foo&) const { return false; }
|
5 bool operator<(const foo&) const { return false; }
|
||||||
6 };
|
6 };
|
||||||
7 int main(int, char*[]) {
|
7 int main(int, char*[]) {
|
||||||
8 std::list<foo> v;
|
8 std::list<foo> v;
|
||||||
@@ -190,18 +192,18 @@ Appendix.
|
|||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
stl_algo.h: In function `void __merge_sort_loop<_List_iterator
|
stl_algo.h: In function `void __merge_sort_loop<_List_iterator
|
||||||
<foo,foo &,foo *>, foo *, int>(_List_iterator<foo,foo &,foo *>,
|
<foo,foo &,foo *>, foo *, int>(_List_iterator<foo,foo &,foo *>,
|
||||||
_List_iterator<foo,foo &,foo *>, foo *, int)':
|
_List_iterator<foo,foo &,foo *>, foo *, int)':
|
||||||
stl_algo.h:1448: instantiated from `__merge_sort_with_buffer
|
stl_algo.h:1448: instantiated from `__merge_sort_with_buffer
|
||||||
<_List_iterator<foo,foo &,foo *>, foo *, int>(
|
<_List_iterator<foo,foo &,foo *>, foo *, int>(
|
||||||
_List_iterator<foo,foo &,foo *>, _List_iterator<foo,foo &,foo *>,
|
_List_iterator<foo,foo &,foo *>, _List_iterator<foo,foo &,foo *>,
|
||||||
foo *, int *)'
|
foo *, int *)'
|
||||||
stl_algo.h:1485: instantiated from `__stable_sort_adaptive<
|
stl_algo.h:1485: instantiated from `__stable_sort_adaptive<
|
||||||
_List_iterator<foo,foo &,foo *>, foo *, int>(_List_iterator
|
_List_iterator<foo,foo &,foo *>, foo *, int>(_List_iterator
|
||||||
<foo,foo &,foo *>, _List_iterator<foo,foo &,foo *>, foo *, int)'
|
<foo,foo &,foo *>, _List_iterator<foo,foo &,foo *>, foo *, int)'
|
||||||
stl_algo.h:1524: instantiated from here
|
stl_algo.h:1524: instantiated from here
|
||||||
stl_algo.h:1377: no match for `_List_iterator<foo,foo &,foo *> & -
|
stl_algo.h:1377: no match for `_List_iterator<foo,foo &,foo *> & -
|
||||||
_List_iterator<foo,foo &,foo *> &'
|
_List_iterator<foo,foo &,foo *> &'
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
In this case, the fundamental error is that
|
In this case, the fundamental error is that
|
||||||
@@ -239,14 +241,14 @@ Library produces):
|
|||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
boost/concept_check.hpp: In method `void LessThanComparableConcept
|
boost/concept_check.hpp: In method `void LessThanComparableConcept
|
||||||
<_List_iterator<foo,foo &,foo *> >::constraints()':
|
<_List_iterator<foo,foo &,foo *> >::constraints()':
|
||||||
boost/concept_check.hpp:334: instantiated from `RandomAccessIteratorConcept
|
boost/concept_check.hpp:334: instantiated from `RandomAccessIteratorConcept
|
||||||
<_List_iterator<foo,foo &,foo *> >::constraints()'
|
<_List_iterator<foo,foo &,foo *> >::constraints()'
|
||||||
bad_error_eg.cpp:9: instantiated from `stable_sort<_List_iterator
|
bad_error_eg.cpp:9: instantiated from `stable_sort<_List_iterator
|
||||||
<foo,foo &,foo *> >(_List_iterator<foo,foo &,foo *>,
|
<foo,foo &,foo *> >(_List_iterator<foo,foo &,foo *>,
|
||||||
_List_iterator<foo,foo &,foo *>)'
|
_List_iterator<foo,foo &,foo *>)'
|
||||||
boost/concept_check.hpp:209: no match for `_List_iterator<foo,foo &,foo *> &
|
boost/concept_check.hpp:209: no match for `_List_iterator<foo,foo &,foo *> &
|
||||||
< _List_iterator<foo,foo &,foo *> &'
|
< _List_iterator<foo,foo &,foo *> &'
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
This message rectifies several of the shortcomings of the standard
|
This message rectifies several of the shortcomings of the standard
|
||||||
@@ -290,7 +292,7 @@ The idea to use function pointers to cause instantiation is due to
|
|||||||
Alexander Stepanov. I am not sure of the origin of the idea to use
|
Alexander Stepanov. I am not sure of the origin of the idea to use
|
||||||
expressions to do up-front checking of templates, but it did appear in
|
expressions to do up-front checking of templates, but it did appear in
|
||||||
D&E[
|
D&E[
|
||||||
<a href="bibliography.html#stroustrup94:_design_evolution">2</a>].
|
<a href="bibliography.htm#stroustrup94:_design_evolution">2</a>].
|
||||||
Thanks to Matt Austern for his excellent documentation and
|
Thanks to Matt Austern for his excellent documentation and
|
||||||
organization of the STL concepts, upon which these concept checks
|
organization of the STL concepts, upon which these concept checks
|
||||||
are based. Thanks to Boost members for helpful comments and
|
are based. Thanks to Boost members for helpful comments and
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
Ideally we would like to catch, and indicate, the concept violation at
|
Ideally we would like to catch, and indicate, the concept violation at
|
||||||
the point of instantiation. As mentioned in D&E[<a
|
the point of instantiation. As mentioned in D&E[<a
|
||||||
href="bibliography.html#stroustrup94:_design_evolution">2</a>], the error
|
href="bibliography.htm#stroustrup94:_design_evolution">2</a>], the error
|
||||||
can be caught by exercising all of the requirements needed by the
|
can be caught by exercising all of the requirements needed by the
|
||||||
function template. Exactly how the requirements (the valid
|
function template. Exactly how the requirements (the valid
|
||||||
expressions in particular) are exercised is a tricky issue, since we
|
expressions in particular) are exercised is a tricky issue, since we
|
||||||
@@ -189,7 +189,7 @@ type.
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="./reference.htm">Next: Reference</a><br>
|
<a href="./reference.htm">Next: Reference</a><br>
|
||||||
<a href="./prog_with_concepts.html">Prev: Programming With Concepts</a>
|
<a href="prog_with_concepts.htm">Prev: Programming With Concepts</a>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<HR>
|
<HR>
|
||||||
|
Reference in New Issue
Block a user