boost::range::copy_n
References
Headers
boost::range::copy_n
is available by including
any of the following headers:
boost/range/algorithm_ext/copy_n.hpp
orboost/range/algorithm_ext.hpp
Examples
copy_n.cpp
#include <iostream>
#include <vector>
#include <boost/range/algorithm_ext.hpp>
int main() {
std::vector<int> vec = {1, 2, 3, 4, 5};
// Copy n elements to an output iterator.
boost::range::copy_n(vec, 3, std::ostream_iterator<int>(std::cout, " "));
std::cout << std::endl;
return 0;
}
Output:
1 2 3
Boost Range for Humans
This reference is part of Boost Range for Humans. Click the link to the overview.