Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.



      typename Sequence
struct pop_back
    typedef unspecified type;


pop_back performs a removal at the end of the sequence. The algorithm returns a new sequence which contains all the elements in the range [begin<Sequence>::type, prior< end<Sequence>::type >::type). The result sequence preserves all the functional and performance characteristics of the original Sequence, except its size and identity.


#include "boost/mpl/pop_back.hpp"


 Parameter  Requirement  Description  
SequenceA model of Extensible SequenceA sequence to handle the erase operation

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
typedef pop_back<Sequence>::type s;A model of Extensible Sequenceempty<Sequence>::type::value == falseEquivalent to typedef erase< Sequence, prior< end<Sequence>::type >::type >::type s;size<s>::type::value == size<Sequence>::type::value - 1


Amortized constant time [1].


typedef list<long>::type types1;
typedef list<long,int>::type types2;
typedef list<long,int,char>::type types3;

typedef pop_back<types1>::type result1; typedef pop_back<types2>::type result2; typedef pop_back<types3>::type result3;

BOOST_STATIC_ASSERT(size<result1>::type::value == 0); BOOST_STATIC_ASSERT(size<result2>::type::value == 1); BOOST_STATIC_ASSERT(size<result3>::type::value == 2);

BOOST_MPL_ASSERT_IS_SAME(back<result2>::type, long); BOOST_MPL_ASSERT_IS_SAME(back<result3>::type, int);


[1] The algorithm is provided only if the sequence can meet the stated complexity requirements.

See also

Extensible Sequence, erase, push_back, back, pop_front

Table of Contents
Last edited July 17, 2002 3:56 am