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