The C++11 standard library includes the following related algorithms:
template <class InputIterator, class ForwardIterator>
ForwardIterator uninitialized_copy(InputIterator first, InputIterator last,
ForwardIterator result);
template <class ForwardIterator, class T>
void uninitialized_fill(ForwardIterator first, ForwardIterator last,
const T& x);
template<class InputIterator, class OutputIterator>
OutputIterator copy(InputIterator first, InputIterator last,
OutputIterator result);
template<class ForwardIterator, class T>
void fill(ForwardIterator first, ForwardIterator last, const T& value);
template<class InputIterator, class OutputIterator>
OutputIterator move(InputIterator first, InputIterator last,
OutputIterator result);
There is no standard uninitialized_move
algorithm. Is this an oversight, or by design?
If it is by design, what is the rationale?
You can get the effect of an uninitialized_move
with uninitialized_copy
and move iterators:
std::uninitialized_copy(std::make_move_iterator(first),
std::make_move_iterator(last),
out);
std::move
exists even though it can also be implemented with std::copy
and move iterators, because the committee anticipated its use to be frequent and decided to provide it as a convenience function [1][2].
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With