1.. Sequences/Classes//range_c |60 2 3range_c 4======= 5 6Synopsis 7-------- 8 9.. parsed-literal:: 10 11 template< 12 typename T 13 , T Start 14 , T Finish 15 > 16 struct range_c 17 { 18 typedef integral_c<T,Start> start; 19 typedef integral_c<T,Finish> finish; 20 // |unspecified| 21 // |...| 22 }; 23 24 25Description 26----------- 27 28``range_c`` is a sorted |Random Access Sequence| of |Integral Constant|\ s. Note 29that because it is not an |Extensible Sequence|, sequence-building 30intrinsic metafunctions such as ``push_front`` and transformation algorithms 31such as ``replace`` are not directly applicable |--| to be able to use 32them, you'd first need to copy the content of the range into a more suitable 33sequence. 34 35 36Header 37------ 38 39.. parsed-literal:: 40 41 #include <boost/mpl/range_c.hpp> 42 43 44Model of 45-------- 46 47|Random Access Sequence| 48 49 50Expression semantics 51-------------------- 52 53In the following table, ``r`` is an instance of ``range_c``, ``n`` is an |Integral Constant|, 54``T`` is an arbitrary integral type, and ``n`` and ``m`` are integral constant values of type ``T``. 55 56+-------------------------------+-----------------------------------------------------------+ 57| Expression | Semantics | 58+===============================+===========================================================+ 59| .. parsed-literal:: | A sorted |Random Access Sequence| of integral constant | 60| | wrappers for the half-open range of values [\ ``n``, | 61| ``range_c<T,n,m>`` | ``m``): ``integral_c<T,n>``, ``integral_c<T,n+1>``,... | 62| ``range_c<T,n,m>::type`` | ``integral_c<T,m-1>``. | 63| | | 64+-------------------------------+-----------------------------------------------------------+ 65| ``begin<r>::type`` | An iterator pointing to the beginning of ``r``; | 66| | see |Random Access Sequence|. | 67+-------------------------------+-----------------------------------------------------------+ 68| ``end<r>::type`` | An iterator pointing to the end of ``r``; | 69| | see |Random Access Sequence|. | 70+-------------------------------+-----------------------------------------------------------+ 71| ``size<r>::type`` | The size of ``r``; see |Random Access Sequence|. | 72+-------------------------------+-----------------------------------------------------------+ 73| ``empty<r>::type`` | |true if and only if| ``r`` is empty; see | 74| | |Random Access Sequence|. | 75+-------------------------------+-----------------------------------------------------------+ 76| ``front<r>::type`` | The first element in ``r``; see | 77| | |Random Access Sequence|. | 78+-------------------------------+-----------------------------------------------------------+ 79| ``back<r>::type`` | The last element in ``r``; see | 80| | |Random Access Sequence|. | 81+-------------------------------+-----------------------------------------------------------+ 82| ``at<r,n>::type`` | The ``n``\ th element from the beginning of ``r``; see | 83| | |Random Access Sequence|. | 84+-------------------------------+-----------------------------------------------------------+ 85 86 87Example 88------- 89 90.. parsed-literal:: 91 92 typedef range_c<int,0,0> range0; 93 typedef range_c<int,0,1> range1; 94 typedef range_c<int,0,10> range10; 95 96 BOOST_MPL_ASSERT_RELATION( size<range0>::value, ==, 0 ); 97 BOOST_MPL_ASSERT_RELATION( size<range1>::value, ==, 1 ); 98 BOOST_MPL_ASSERT_RELATION( size<range10>::value, ==, 10 ); 99 100 BOOST_MPL_ASSERT(( empty<range0> )); 101 BOOST_MPL_ASSERT_NOT(( empty<range1> )); 102 BOOST_MPL_ASSERT_NOT(( empty<range10> )); 103 104 BOOST_MPL_ASSERT(( is_same< begin<range0>::type, end<range0>::type > )); 105 BOOST_MPL_ASSERT_NOT(( is_same< begin<range1>::type, end<range1>::type > )); 106 BOOST_MPL_ASSERT_NOT(( is_same< begin<range10>::type, end<range10>::type > )); 107 108 BOOST_MPL_ASSERT_RELATION( front<range1>::type::value, ==, 0 ); 109 BOOST_MPL_ASSERT_RELATION( back<range1>::type::value, ==, 0 ); 110 BOOST_MPL_ASSERT_RELATION( front<range10>::type::value, ==, 0 ); 111 BOOST_MPL_ASSERT_RELATION( back<range10>::type::value, ==, 9 ); 112 113 114See also 115-------- 116 117|Sequences|, |Random Access Sequence|, |vector_c|, |set_c|, |list_c| 118 119 120.. copyright:: Copyright � 2001-2009 Aleksey Gurtovoy and David Abrahams 121 Distributed under the Boost Software License, Version 1.0. (See accompanying 122 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 123