boost::range::push_front

References

Headers

boost::range::push_front is available by including any of the following headers:

  • boost/range/algorithm_ext/push_front.hpp or
  • boost/range/algorithm_ext.hpp

Examples

push_front.cpp

#include <iostream>
#include <vector>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>

int main() {
    std::vector<int> src = {3, 4, 5};
    std::vector<int> target = {95, 96, 97, 98, 99};

    // Copy values from a range to a container, inserting them with push_front().
    // Returns a reference to the target container.
    boost::range::push_front(target, src);

    boost::copy(target, std::ostream_iterator<int>(std::cout, " "));
    std::cout << std::endl;
    return 0;
}

Output:

3 4 5 95 96 97 98 99

 

Boost Range for Humans

This reference is part of Boost Range for Humans. Click the link to the overview.