...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Front Page / Sequences / Intrinsic Metafunctions / push_front |
template< typename Sequence , typename T > struct push_front { typedef unspecified type; };
push_front performs an insertion at the beginning of the sequence with guaranteed O(1) complexity.
#include <boost/mpl/push_front.hpp>
Parameter | Requirement | Description |
---|---|---|
Sequence | Front Extensible Sequence | A sequence to insert into. |
T | Any type | The element to be inserted. |
For any Front Extensible Sequence s and arbitrary type x:
typedef push_front::type r;
Return type: | |
---|---|
Semantics: | Equivalent to typedef insert< s,begin |
Postcondition: | size |
Amortized constant time.
typedef vector_cv; BOOST_MPL_ASSERT_RELATION( size ::value, ==, 7 ); typedef push_front< v,integral_c >::type fibonacci; BOOST_MPL_ASSERT_RELATION( size ::value, ==, 8 ); BOOST_MPL_ASSERT(( equal< fibonacci , vector_c , equal_to<_,_> > ));