.. Sequences/Intrinsic Metafunctions//pop_back pop_back ======== Synopsis -------- .. parsed-literal:: template< typename Sequence > struct pop_back { typedef |unspecified| type; }; Description ----------- ``pop_back`` performs a removal at the end of the sequence with guaranteed |O(1)| complexity. Header ------ .. parsed-literal:: #include Model of -------- |Tag Dispatched Metafunction| Parameters ---------- +---------------+-------------------------------+-----------------------------------------------+ | Parameter | Requirement | Description | +===============+===============================+===============================================+ | ``Sequence`` | |Back Extensible Sequence| | A sequence to erase the last element from. | +---------------+-------------------------------+-----------------------------------------------+ Expression semantics -------------------- For any |Back Extensible Sequence| ``s``: .. parsed-literal:: typedef pop_back::type r; :Return type: |Back Extensible Sequence|. :Precondition: ``empty::value == false``. :Semantics: Equivalent to ``erase::type>::type;``. :Postcondition: ``size::value == size::value - 1``. Complexity ---------- Amortized constant time. Example ------- .. parsed-literal:: typedef vector::type types1; typedef vector::type types2; typedef vector::type types3; typedef pop_back::type result1; typedef pop_back::type result2; typedef pop_back::type result3; BOOST_MPL_ASSERT_RELATION( size::value, ==, 0 ); BOOST_MPL_ASSERT_RELATION( size::value, ==, 1 ); BOOST_MPL_ASSERT_RELATION( size::value, ==, 2 ); BOOST_MPL_ASSERT(( is_same< back::type, long> )); BOOST_MPL_ASSERT(( is_same< back::type, int > )); See also -------- |Back Extensible Sequence|, |erase|, |push_back|, |back|, |pop_front|