chsvlib
chsv helper source code

◆ construct_copy()

OutputIterator Chusov::Memory::construct_copy ( InputIterator  start,
InputIterator  end,
OutputIterator  output 
)
noexcept

Copy-constructs a sequence of elements associated with an output iterator from an input sequence addressed by a pair of input iterators.

Template Parameters
InputIteratorThe type of an input iterator which addresses the input sequence of elements to copy.
OutputIteratorThe type of an output iterator specifying the destination of the copy operation. Dereferencing of the output iterator must yield a reference to an actual buffer where the construction of new elements shall take place.
Parameters
startThe input iterator associated with the beginning of the input sequence of elements to copy.
endThe input iterator associated with the past-the-end position of the input sequence.
outputThe output iterator. The expression *output must yield a reference to the actual buffer, in an uninitialized state, where the corresponding element of the output sequence is copy-constructed.
Returns
The output iterator after the copy operation, i.e. the iterator associated with the position in the destination after the last constructed element, or output, if the input sequence is empty.
Exceptions
Anyexception that originates from copy-construction of the sequence elements.

The function behaves exactly like the standard std::copy except that construct_copy performs copy-construction in uninitialized memory space rather than assignment of sequence elements. Also, the input and output sequences must not overlap in memory.

The operation does not invoke any destructors or assignment operators for elements of the copied sequences, i.e. the function copies elements into uninitialized memory buffers discarding its prior contents. To replace existing elements with copy-assignment, use the copy function.