[uninitialized.move] (original) (raw)

26 Algorithms library [algorithms]

26.11 Specialized algorithms [specialized.algorithms]

26.11.6 uninitialized_move [uninitialized.move]

template<class InputIterator, class NoThrowForwardIterator> constexpr NoThrowForwardIterator uninitialized_move(InputIterator first, InputIterator last, NoThrowForwardIterator result);

Preconditions: does not overlap with [first, last).

Effects: Equivalent to:for (; first != last; (void)++result, ++first) ::new (voidify(*result)) typename iterator_traits<NoThrowForwardIterator>::value_type(deref-move(first));return result;

namespace ranges { template<[input_iterator](iterator.concept.input#concept:input%5Fiterator "24.3.4.9 Concept input_­iterator [iterator.concept.input]") I, [sentinel_for](iterator.concept.sentinel#concept:sentinel%5Ffor "24.3.4.7 Concept sentinel_­for [iterator.concept.sentinel]")<I> S1,[_nothrow-forward-iterator_](special.mem.concepts#concept:nothrow-forward-iterator "26.11.2 Special memory concepts [special.mem.concepts]") O, [_nothrow-sentinel-for_](special.mem.concepts#concept:nothrow-sentinel-for "26.11.2 Special memory concepts [special.mem.concepts]")<O> S2> requires [constructible_from](concept.constructible#concept:constructible%5Ffrom "18.4.11 Concept constructible_­from [concept.constructible]")<iter_value_t<O>, iter_rvalue_reference_t<I>> constexpr uninitialized_move_result<I, O> uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast);template<[input_range](range.refinements#concept:input%5Frange "25.4.5 Other range refinements [range.refinements]") IR, [_nothrow-forward-range_](special.mem.concepts#concept:nothrow-forward-range "26.11.2 Special memory concepts [special.mem.concepts]") OR> requires [constructible_from](concept.constructible#concept:constructible%5Ffrom "18.4.11 Concept constructible_­from [concept.constructible]")<range_value_t<OR>, range_rvalue_reference_t<IR>> constexpr uninitialized_move_result<borrowed_iterator_t<IR>, borrowed_iterator_t<OR>> uninitialized_move(IR&& in_range, OR&& out_range);}

Preconditions: [ofirst, olast) does not overlap with [ifirst, ilast).

Effects: Equivalent to:for (; ifirst != ilast && ofirst != olast; ++ofirst, (void)++ifirst) ::new (voidify(*ofirst)) remove_reference_t<iter_reference_t<O>>(ranges::iter_move(ifirst));return {std::move(ifirst), ofirst};

[Note 1:

If an exception is thrown, some objects in the range [ifirst, ilast) are left in a valid, but unspecified state.

— _end note_]

template<class InputIterator, class Size, class NoThrowForwardIterator> constexpr pair<InputIterator, NoThrowForwardIterator> uninitialized_move_n(InputIterator first, Size n, NoThrowForwardIterator result);

Preconditions: does not overlap with .

Effects: Equivalent to:for (; n > 0; ++result, (void)++first, --n) ::new (voidify(*result)) typename iterator_traits<NoThrowForwardIterator>::value_type(deref-move(first));return {first, result};

Preconditions: [ofirst, olast) does not overlap with .

Effects: Equivalent to:auto t = uninitialized_move(counted_iterator(std::move(ifirst), n), default_sentinel, ofirst, olast);return {std::move(t.in).base(), t.out};

[Note 2:

If an exception is thrown, some objects in the rangeare left in a valid but unspecified state.

— _end note_]