3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/push-front.html
| Prev Next | Back Along | Up Home | Full TOC | Front Page / Sequences / Intrinsic Metafunctions / push_front |
template<
typename Sequence
, typename T
>
struct[push\_front](./push-front.html){
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](../../../../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](./push-front.html)<s,x>::type r;
| Return type: |
| | Semantics: |
Equivalent to
typedef[insert](./insert.html)< s,[begin](./begin.html)<s>::type,x >::type r;
| | Postcondition: |
size<r>::value == size<s>::value + 1; front<r>::type is identical to x.
|
Amortized constant time.
typedef[vector\_c](./vector-c.html)<int,1,2,3,5,8,13,21> v;[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)([size](./size.html)<v>::value, ==, 7 );
typedef[push\_front](./push-front.html)< v,[integral\_c](./integral-c.html)<int,1> >::type fibonacci;[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)([size](./size.html)<fibonacci>::value, ==, 8 );[BOOST\_MPL\_ASSERT](./assert.html)(([equal](./equal.html)<
fibonacci
,[vector\_c](./vector-c.html)<int,1,1,2,3,5,8,13,21>
,[equal\_to](./equal-to.html)<_,_>
> ));
Front Extensible Sequence, insert, pop_front, front, push_back
| Prev Next | Back Along | Up Home | Full TOC |
Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |