8#ifndef ADOBE_ALGORITHM_COPY_HPP
9#define ADOBE_ALGORITHM_COPY_HPP
13#include <boost/range/begin.hpp>
14#include <boost/range/end.hpp>
15#include <boost/range/size.hpp>
41template <
class InputRange,
class OutputIterator>
42inline OutputIterator
copy(
const InputRange& range, OutputIterator result) {
43 return std::copy(boost::begin(range), boost::end(range), result);
51template <
class B
idirectionalRange1,
class B
idirectionalIterator2>
53 BidirectionalIterator2 result) {
54 return std::copy_backward(boost::begin(range1), boost::end(range1), result);
62template <
class B
idirectionalRange1,
class B
idirectionalIterator2>
63inline BidirectionalIterator2
copy_backward(
const BidirectionalRange1& range1,
64 BidirectionalIterator2 result) {
65 return std::copy_backward(boost::begin(range1), boost::end(range1), result);
69#ifndef ADOBE_NO_DOCUMENTATION
70namespace implementation {
77template <
class InputIter,
class Size,
class OutputIter>
78std::pair<InputIter, OutputIter> copy_n(InputIter first, Size
count, OutputIter result,
79 std::input_iterator_tag) {
85 return std::pair<InputIter, OutputIter>(first, result);
93template <
class RAIter,
class Size,
class OutputIter>
94inline std::pair<RAIter, OutputIter> copy_n(RAIter first, Size
count, OutputIter result,
95 std::random_access_iterator_tag) {
96 RAIter last = first +
count;
97 return std::pair<RAIter, OutputIter>(last, std::copy(first, last, result));
111template <
class InputIter,
class Size,
class OutputIter>
112inline std::pair<InputIter, OutputIter>
copy_n(InputIter first, Size
count, OutputIter result) {
113 return implementation::copy_n(first,
count, result,
114 typename std::iterator_traits<InputIter>::iterator_category());
119#ifndef ADOBE_NO_DOCUMENTATION
120namespace implementation {
133inline std::pair<I, F> copy_bounded(I first, I last, F result_first, F result_last,
134 std::random_access_iterator_tag,
135 std::random_access_iterator_tag) {
136 return adobe::copy_n(first, std::min(last - first, result_last - result_first), result_first);
147inline std::pair<I, F> copy_bounded(I first, I last, F result_first, F result_last,
148 std::input_iterator_tag, std::forward_iterator_tag) {
149 while (first != last && result_first != result_last) {
150 *result_first = *first;
155 return std::make_pair(first, result_first);
172inline std::pair<I, F>
copy_bounded(I first, I last, F result_first, F result_last) {
173 return implementation::copy_bounded(first, last, result_first, result_last,
174 typename std::iterator_traits<I>::iterator_category(),
175 typename std::iterator_traits<F>::iterator_category());
194 return std::make_pair(f, o);
208 return copy_sentinal(f, o,
typename std::iterator_traits<I>::value_type());
std::pair< I, F > copy_bounded(I first, I last, F result_first, F result_last)
copy implementation
OutputIterator copy(const InputRange &range, OutputIterator result)
copy implementation
BidirectionalIterator2 copy_backward(BidirectionalRange1 &range1, BidirectionalIterator2 result)
copy implementation
std::pair< I, O > copy_sentinal(I f, O o, const T &x)
copy implementation
std::pair< InputIter, OutputIter > copy_n(InputIter first, Size count, OutputIter result)
copy implementation
boost::range_difference< InputRange >::type count(InputRange &range, T &value)
count implementation