.. Sequences/Classes//range_c |60 range_c ======= Synopsis -------- .. parsed-literal:: template< typename T , T Start , T Finish > struct range_c { typedef integral_c start; typedef integral_c finish; // |unspecified| // |...| }; Description ----------- ``range_c`` is a sorted |Random Access Sequence| of |Integral Constant|\ s. Note that because it is not an |Extensible Sequence|, sequence-building intrinsic metafunctions such as ``push_front`` and transformation algorithms such as ``replace`` are not directly applicable |--| to be able to use them, you'd first need to copy the content of the range into a more suitable sequence. Header ------ .. parsed-literal:: #include Model of -------- |Random Access Sequence| Expression semantics -------------------- In the following table, ``r`` is an instance of ``range_c``, ``n`` is an |Integral Constant|, ``T`` is an arbitrary integral type, and ``n`` and ``m`` are integral constant values of type ``T``. +-------------------------------+-----------------------------------------------------------+ | Expression | Semantics | +===============================+===========================================================+ | .. parsed-literal:: | A sorted |Random Access Sequence| of integral constant | | | wrappers for the half-open range of values [\ ``n``, | | ``range_c`` | ``m``): ``integral_c``, ``integral_c``,... | | ``range_c::type`` | ``integral_c``. | | | | +-------------------------------+-----------------------------------------------------------+ | ``begin::type`` | An iterator pointing to the beginning of ``r``; | | | see |Random Access Sequence|. | +-------------------------------+-----------------------------------------------------------+ | ``end::type`` | An iterator pointing to the end of ``r``; | | | see |Random Access Sequence|. | +-------------------------------+-----------------------------------------------------------+ | ``size::type`` | The size of ``r``; see |Random Access Sequence|. | +-------------------------------+-----------------------------------------------------------+ | ``empty::type`` | |true if and only if| ``r`` is empty; see | | | |Random Access Sequence|. | +-------------------------------+-----------------------------------------------------------+ | ``front::type`` | The first element in ``r``; see | | | |Random Access Sequence|. | +-------------------------------+-----------------------------------------------------------+ | ``back::type`` | The last element in ``r``; see | | | |Random Access Sequence|. | +-------------------------------+-----------------------------------------------------------+ | ``at::type`` | The ``n``\ th element from the beginning of ``r``; see | | | |Random Access Sequence|. | +-------------------------------+-----------------------------------------------------------+ Example ------- .. parsed-literal:: typedef range_c range0; typedef range_c range1; typedef range_c range10; BOOST_MPL_ASSERT_RELATION( size::value, ==, 0 ); BOOST_MPL_ASSERT_RELATION( size::value, ==, 1 ); BOOST_MPL_ASSERT_RELATION( size::value, ==, 10 ); BOOST_MPL_ASSERT(( empty )); BOOST_MPL_ASSERT_NOT(( empty )); BOOST_MPL_ASSERT_NOT(( empty )); BOOST_MPL_ASSERT(( is_same< begin::type, end::type > )); BOOST_MPL_ASSERT_NOT(( is_same< begin::type, end::type > )); BOOST_MPL_ASSERT_NOT(( is_same< begin::type, end::type > )); BOOST_MPL_ASSERT_RELATION( front::type::value, ==, 0 ); BOOST_MPL_ASSERT_RELATION( back::type::value, ==, 0 ); BOOST_MPL_ASSERT_RELATION( front::type::value, ==, 0 ); BOOST_MPL_ASSERT_RELATION( back::type::value, ==, 9 ); See also -------- |Sequences|, |Random Access Sequence|, |vector_c|, |set_c|, |list_c|