1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Concept Checking</title> 5<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../index.html" title="Chapter 1. Range 2.0"> 8<link rel="up" href="../concepts.html" title="Range Concepts"> 9<link rel="prev" href="random_access_range.html" title="Random Access Range"> 10<link rel="next" href="../reference.html" title="Reference"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="random_access_range.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h3 class="title"> 27<a name="range.concepts.concept_checking"></a><a class="link" href="concept_checking.html" title="Concept Checking">Concept Checking</a> 28</h3></div></div></div> 29<p> 30 Each of the range concepts has a corresponding concept checking class in 31 the file <a href="../../../../../../boost/range/concepts.hpp" target="_top"><code class="computeroutput"><span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">range</span><span class="special">/</span><span class="identifier">concepts</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code></a>. 32 These classes may be used in conjunction with the <a href="../../../../../../libs/concept_check/index.html" target="_top">Boost 33 Concept Check library</a> to ensure that the type of a template parameter 34 is compatible with a range concept. If not, a meaningful compile time error 35 is generated. Checks are provided for the range concepts related to iterator 36 traversal categories. For example, the following line checks that the type 37 <code class="computeroutput"><span class="identifier">T</span></code> models the <a class="link" href="forward_range.html" title="Forward Range">Forward 38 Range</a> concept. 39 </p> 40<p> 41</p> 42<pre class="programlisting"><span class="identifier">BOOST_CONCEPT_ASSERT</span><span class="special">((</span> <span class="identifier">ForwardRangeConcept</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">));</span> 43</pre> 44<p> 45 </p> 46<p> 47 An additional concept check is required for the value access property of 48 the range based on the range's iterator type. For example to check for a 49 ForwardReadableRange, the following code is required. 50 </p> 51<p> 52</p> 53<pre class="programlisting"><span class="identifier">BOOST_CONCEPT_ASSERT</span><span class="special">((</span> <span class="identifier">ForwardRangeConcept</span><span class="special"><</span><span class="identifier">T</span><span class="special">></span> <span class="special">));</span> 54<span class="identifier">BOOST_CONCEPT_ASSERT</span><span class="special">((</span> <span class="identifier">ReadableIteratorConcept</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">range_iterator</span><span class="special"><</span><span class="identifier">T</span><span class="special">>::</span><span class="identifier">type</span><span class="special">></span> <span class="special">));</span> 55</pre> 56<p> 57 </p> 58<p> 59 The following range concept checking classes are provided. 60 </p> 61<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 62<li class="listitem"> 63 Class SinglePassRangeConcept checks for <a class="link" href="single_pass_range.html" title="Single Pass Range">Single 64 Pass Range</a> 65 </li> 66<li class="listitem"> 67 Class ForwardRangeConcept checks for <a class="link" href="forward_range.html" title="Forward Range">Forward 68 Range</a> 69 </li> 70<li class="listitem"> 71 Class BidirectionalRangeConcept checks for <a class="link" href="bidirectional_range.html" title="Bidirectional Range">Bidirectional 72 Range</a> 73 </li> 74<li class="listitem"> 75 Class RandomAccessRangeConcept checks for <a class="link" href="random_access_range.html" title="Random Access Range">Random 76 Access Range</a> 77 </li> 78</ul></div> 79<h5> 80<a name="range.concepts.concept_checking.h0"></a> 81 <span class="phrase"><a name="range.concepts.concept_checking.see_also"></a></span><a class="link" href="concept_checking.html#range.concepts.concept_checking.see_also">See 82 also</a> 83 </h5> 84<p> 85 <a class="link" href="../style_guide.html" title="Terminology and style guidelines">Range Terminology and style guidelines</a> 86 </p> 87<p> 88 <a href="../../../../../../libs/iterator/doc/iterator_concepts.html" target="_top">Iterator concepts</a> 89 </p> 90<p> 91 <a href="../../../../../../libs/concept_check/index.html" target="_top">Boost Concept Check library</a> 92 </p> 93</div> 94<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 95<td align="left"></td> 96<td align="right"><div class="copyright-footer">Copyright © 2003-2010 Thorsten Ottosen, 97 Neil Groves<p> 98 Distributed under the Boost Software License, Version 1.0. (See accompanying 99 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 100 </p> 101</div></td> 102</tr></table> 103<hr> 104<div class="spirit-nav"> 105<a accesskey="p" href="random_access_range.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../reference.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 106</div> 107</body> 108</html> 109