Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
push_front
Description

Returns a new sequence with an element added at the beginning.

Synopsis
template<
    typename Sequence,
    typename T
    >
typename result_of::push_front<Sequence, T>::type push_front(
    Sequence const& seq, T const& t);

Parameters

Parameter Requirement Description
seq A model of Forward Sequence Operation's argument
t Any type The value to add to the beginning
Expression Semantics
push_back(seq, t);

Return type: A model of Forward Sequence.

Semantics: Returns a new sequence, containing all the elements of seq, and new element t appended to the beginning. The elements are in the same order as they were in seq.

Complexity

Constant. Returns a view which is lazily evaluated.

Header
#include <boost/fusion/algorithm/transformation/push_front.hpp>
Example
assert(push_front(make_vector(1,2,3),0) == make_vector(0,1,2,3));
Copyright © 2001-2005 Joel de Guzman, Dan Marsden

PrevUpHomeNext