◐ Shell
clean mode source ↗

std::uninitialized_copy – cppreference.com

Aus cppreference.com

<metanoindex/>

<tbody> </tbody>

definiert in Header

<memory>

template< class InputIt, class ForwardIt > ForwardIt uninitialized_copy( InputIt first, InputIt last, ForwardIt d_first );

Kopiert Elemente aus dem Bereich [first, last) auf einen nicht initialisierten Speicherbereich beginnend mit d_first. Die Elemente in der initialisierten Bereich werden mit Hilfe von Copy-Konstruktor .

Original:

Copies elements from the range [first, last) to an uninitialized memory area beginning at d_first. The elements in the uninitialized area are constructed using copy constructor.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Parameter

first, last -

der Bereich der Elemente zu kopieren

Original:

the range of the elements to copy

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

d_first -

der Beginn des Zielbereichs

Original:

the beginning of the destination range

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Type requirements
-InputIt must meet the requirements of InputIterator.
-ForwardIt must meet the requirements of ForwardIterator.

Rückgabewert

Iterator das Element nach dem letzten Element kopiert .

Original:

Iterator to the element past the last element copied.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Komplexität

Linear im Abstand first und last

Original:

Linear in the distance between first and last

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Mögliche Implementierung

template<class InputIt, class ForwardIt>
ForwardIt uninitialized_copy(InputIt first, InputIt last, ForwardIt d_first)
{
    typedef typename std::iterator_traits<ForwardIt>::value_type Value;
    for (; first != last; ++first, ++d_first) {
        ::new (static_cast<void*>(&*d_first)) Value(*first);
    }
    return d_first;
}

Beispiel

Siehe auch

kopiert eine Folge von n Objekten in einen nicht initialisierten Bereich des Speichers
(Funktions-Template) [edit]