Back to Arangodb

push_front

3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/push-front.html

3.12.9.13.0 KB
Original Source

| Prev Next | Back Along | Up Home | Full TOC | Front Page / Sequences / Intrinsic Metafunctions / push_front |

push_front

Synopsis

template<
      typename Sequence
    , typename T
    >
struct[push\_front](./push-front.html){
    typedef_unspecified_type;
};

Description

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)>

Model of

Tag Dispatched Metafunction

Parameters

ParameterRequirementDescription
SequenceFront Extensible SequenceA sequence to insert into.
TAny typeThe element to be inserted.

Expression semantics

For any Front Extensible Sequence s and arbitrary type x:

typedef[push\_front](./push-front.html)<s,x>::type r;

| Return type: |

Front Extensible Sequence.

| | 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.

|

Complexity

Amortized constant time.

Example

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)<_,_>
    > ));

See also

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) |