◐ Shell
clean mode source ↗

std::raw_storage_iterator – cppreference.com

Aus cppreference.com

<metanoindex/>

<tbody> </tbody>

definiert in Header

<memory>

template< class OutputIt, class T > class raw_storage_iterator : public std::iterator<std::output_iterator_tag, void, void, void, void>;

Die Ausgabeiterator std::raw_storage_iterator ermöglicht Standardalgorithmen um Ergebnisse in initialisierten Speicher zu speichern. Wenn der Algorithmus ein Objekt vom Typ T der dereferenziert Iterator schreibt, ist das Objekt copy-gebaut in den Standort in der initialisierten Speicher, auf den der Iterator. Der Template-Parameter OutputIt ist jede Art, die dich Anforderungen OutputIterator entspricht und operator* definiert ein Objekt, für das operator& gibt ein Objekt vom Typ T* zurückzukehren. Üblicherweise wird die Aktivität als T* OutputIt verwendet .

Original:

The output iterator std::raw_storage_iterator makes it possible for standard algorithms to store results in uninitialized memory. Whenever the algorithm writes an object of type T to the dereferenced iterator, the object is copy-constructed into the location in the uninitialized storage pointed to by the iterator. The template parameter OutputIt is any type that meets thee requirements of OutputIterator and has operator* defined to return an object, for which operator& returns an object of type T*. Usually, the type T* is used as OutputIt.

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

Type Anforderungen

Member-Funktionen

schafft eine neue raw_storage_iterator

Original:

creates a new raw_storage_iterator

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


(öffentliche Elementfunktion)

gibt einen Verweis auf dieses raw_storage_iterator

Original:

returns a reference to this raw_storage_iterator

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


(öffentliche Elementfunktion)

copy-konstruiert ein Objekt an der spitzen-to Stelle im Puffer

Original:

copy-constructs an object at the pointed-to location in the buffer

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


(öffentliche Elementfunktion)

Fortschritte der Iterator

Original:

advances the iterator

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


(öffentliche Elementfunktion)

Inherited from std::iterator

Member types

Mitglied Typ

Original:

Member type

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

Definition
value_type void
difference_type void
pointer void
reference void
iterator_category std::output_iterator_tag

Beispiel

#include <iostream>
#include <string>
#include <memory>
#include <algorithm>

int main()
{
    const std::string s[] = {"This", "is", "a", "test", "."};
    std::string* p = std::get_temporary_buffer<std::string>(5).first;

    std::copy(std::begin(s), std::end(s),
              std::raw_storage_iterator<std::string*, std::string>(p));

    for(std::string* i = p; i!=p+5; ++i) {
        std::cout << *i << '\n';
        i->~basic_string<char>();
    }
    std::return_temporary_buffer(p);
}

Output:

Siehe auch

liefert Informationen über Allokatoren
(Klassen-Template) [edit]
implementiert die Zuweisung über mehrere Ebenen für Container, die in mehrfachen Ebene unterteilt sind
(Klassen-Template) [edit]
prüft, ob der angegebene Typ allokatorgestützte Erzeugung unterstützt.
(Klassen-Template) [edit]