diff --git a/concept_check.htm b/concept_check.htm index 30cf7fc..f3a863a 100644 --- a/concept_check.htm +++ b/concept_check.htm @@ -11,7 +11,9 @@ -- purpose. It is provided "as is" without express or implied warranty. -->
-Any programmer writing class or function templates ought to make 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 the Standard Library, then simply use the matching concept checking class in the BCCL. If not, then write a new concept checking class - @@ -102,9 +104,9 @@ The documentation is organized into the following sections.
@@ -168,7 +170,7 @@ a linked list. 2 #include <algorithm> 3 4 struct foo { - 5 bool operator<(const foo&) const { return false; } + 5 bool operator<(const foo&) const { return false; } 6 }; 7 int main(int, char*[]) { 8 std::list<foo> v; @@ -190,18 +192,18 @@ Appendix.stl_algo.h: In function `void __merge_sort_loop<_List_iterator - <foo,foo &,foo *>, foo *, int>(_List_iterator<foo,foo &,foo *>, - _List_iterator<foo,foo &,foo *>, foo *, int)': + <foo,foo &,foo *>, foo *, int>(_List_iterator<foo,foo &,foo *>, + _List_iterator<foo,foo &,foo *>, foo *, int)': stl_algo.h:1448: instantiated from `__merge_sort_with_buffer - <_List_iterator<foo,foo &,foo *>, foo *, int>( - _List_iterator<foo,foo &,foo *>, _List_iterator<foo,foo &,foo *>, + <_List_iterator<foo,foo &,foo *>, foo *, int>( + _List_iterator<foo,foo &,foo *>, _List_iterator<foo,foo &,foo *>, foo *, int *)' stl_algo.h:1485: instantiated from `__stable_sort_adaptive< - _List_iterator<foo,foo &,foo *>, foo *, int>(_List_iterator - <foo,foo &,foo *>, _List_iterator<foo,foo &,foo *>, foo *, int)' + _List_iterator<foo,foo &,foo *>, foo *, int>(_List_iterator + <foo,foo &,foo *>, _List_iterator<foo,foo &,foo *>, foo *, int)' stl_algo.h:1524: instantiated from here -stl_algo.h:1377: no match for `_List_iterator<foo,foo &,foo *> & - - _List_iterator<foo,foo &,foo *> &' +stl_algo.h:1377: no match for `_List_iterator<foo,foo &,foo *> & - + _List_iterator<foo,foo &,foo *> &'In this case, the fundamental error is that @@ -239,14 +241,14 @@ Library produces):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 - <_List_iterator<foo,foo &,foo *> >::constraints()' + <_List_iterator<foo,foo &,foo *> >::constraints()' bad_error_eg.cpp:9: instantiated from `stable_sort<_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 *> & - < _List_iterator<foo,foo &,foo *> &' + <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 *> & + < _List_iterator<foo,foo &,foo *> &'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 expressions to do up-front checking of templates, but it did appear in D&E[ -2]. +2]. Thanks to Matt Austern for his excellent documentation and organization of the STL concepts, upon which these concept checks are based. Thanks to Boost members for helpful comments and diff --git a/implementation.htm b/implementation.htm index ee1ec22..7e65746 100644 --- a/implementation.htm +++ b/implementation.htm @@ -24,7 +24,7 @@ Ideally we would like to catch, and indicate, the concept violation at the point of instantiation. As mentioned in D&E[2], the error +href="bibliography.htm#stroustrup94:_design_evolution">2], the error can be caught by exercising all of the requirements needed by the function template. Exactly how the requirements (the valid expressions in particular) are exercised is a tricky issue, since we @@ -189,7 +189,7 @@ type.Next: Reference
-Prev: Programming With Concepts +Prev: Programming With Concepts