1.. Sequences/Intrinsic Metafunctions//at_c 2 3at_c 4==== 5 6Synopsis 7-------- 8 9.. parsed-literal:: 10 11 template< 12 typename Sequence 13 , long n 14 > 15 struct at_c 16 { 17 typedef |unspecified| type; 18 }; 19 20 21 22Description 23----------- 24 25Returns a type identical to the ``n``\ th element from the beginning of 26the sequence. ``at_c<Sequence,n>::type`` is a shorcut notation for 27``at< Sequence, long_<n> >::type``. 28 29 30Header 31------ 32 33.. parsed-literal:: 34 35 #include <boost/mpl/at.hpp> 36 37 38 39Parameters 40---------- 41 42+---------------+-----------------------------------+-----------------------------------------------+ 43| Parameter | Requirement | Description | 44+===============+===================================+===============================================+ 45| ``Sequence`` | |Forward Sequence| | A sequence to be examined. | 46+---------------+-----------------------------------+-----------------------------------------------+ 47| ``n`` | A compile-time integral constant | An offset from the beginning of the sequence | 48| | | specifying the element to be retrieved. | 49+---------------+-----------------------------------+-----------------------------------------------+ 50 51 52Expression semantics 53-------------------- 54 55 56.. parsed-literal:: 57 58 typedef at_c<Sequence,n>::type t; 59 60:Return type: 61 A type 62 63:Precondition: 64 ``0 <= n < size<Sequence>::value`` 65 66:Semantics: 67 Equivalent to 68 69 .. parsed-literal:: 70 71 typedef at< Sequence, long_<n> >::type t; 72 73 74Complexity 75---------- 76 77+-------------------------------+-----------------------------------+ 78| Sequence archetype | Complexity | 79+===============================+===================================+ 80| |Forward Sequence| | Linear. | 81+-------------------------------+-----------------------------------+ 82| |Random Access Sequence| | Amortized constant time. | 83+-------------------------------+-----------------------------------+ 84 85 86Example 87------- 88 89.. parsed-literal:: 90 91 typedef range_c<long,10,50> range; 92 BOOST_MPL_ASSERT_RELATION( (at_c< range,0 >::type::value), ==, 10 ); 93 BOOST_MPL_ASSERT_RELATION( (at_c< range,10 >::type::value), ==, 20 ); 94 BOOST_MPL_ASSERT_RELATION( (at_c< range,40 >::type::value), ==, 50 ); 95 96 97See also 98-------- 99 100|Forward Sequence|, |Random Access Sequence|, |at|, |front|, |back| 101 102 103.. copyright:: Copyright � 2001-2009 Aleksey Gurtovoy and David Abrahams 104 Distributed under the Boost Software License, Version 1.0. (See accompanying 105 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 106