Partager via


raw_storage_iterator Class

An adaptor class that is provided to enable algorithms to store their results into uninitialized memory.

template <class OutputIterator, class Type>
class raw_storage_iterator

Parameters

  • OutputIterator
    Specifies the output iterator for the object being stored.

  • Type
    The type of object for which storage is being allocated.

Remarks

The class describes an output iterator that constructs objects of type Type in the sequence it generates. An object of class raw_storage_iterator<ForwardIterator, Type> accesses storage through a forward iterator object, of class ForwardIterator, that you specify when you construct the object. For an object first of class ForwardIterator, the expression &*first must designate unconstructed storage for the next object (of type Type) in the generated sequence.

This adaptor class is used when it is necessary to separate memory allocation and object construction. The raw_storage_iterator can be used to copy objects into uninitialized storage, such as memory allocated using the malloc function.

Members

Constructors

raw_storage_iterator

Constructs a raw storage iterator with a specified underlying output iterator.

Typedefs

element_type

Provides a type that describes an element to be stored a raw storage iterator.

iter_type

Provides a type that describes an iterator that underlies a raw storage iterator.

Operators

operator*

A dereferencing operator used to implement the output iterator expression *ii = x.

operator=

An assignment operator used to implement the raw storage iterator expression *i = x for storing in memory.

operator++

Preincrement and postincrement operators for raw storage iterators.

Requirements

Header: <memory>

Namespace: std

See Also

Reference

Thread Safety in the C++ Standard Library