Apache C++ Standard Library Reference Guide

## raw_storage_iterator

Library: General utilities

    raw_storage_iterator  iterator

- Local Index
- Summary
- Synopsis
- Description
- Interface
- Constructor
- Member Operators
- Standards Conformance

### Local Index

#### Members

operator*() | operator++() | operator=() | raw_storage_iterator()

### Summary

Enables iterator-based algorithms to store results in uninitialized memory.

### Synopsis

    #include <memory>

    namespace std {
      template <class OutputIterator, class T>
      class raw_storage_iterator;
    }

### Description

Class raw_storage_iterator enables iterator-based algorithms to store their results in uninitialized memory. The template parameter `OutputIterator` is required to have its `operator*` return an object for which `operator&` is both defined and returns a pointer to `T`.

### Interface

    namespace std {

      template <class OutputIterator, class T>
      class raw_storage_iterator
        : public iterator <output_iterator_tag,
                           void,void,void,void> {

        public:
          typedef OutputIterator iterator_type;

          explicit raw_storage_iterator(OutputIterator);
          raw_storage_iterator<OutputIterator, T>&
          operator*();
          raw_storage_iterator<OutputIterator, T>&
          operator=(const T&);
          raw_storage_iterator<OutputIterator, T>&
          operator++();
          raw_storage_iterator<OutputIterator, T>
          operator++(int);
       };
    }

### Constructor

    raw_storage_iterator (iterator_type x);

Initializes the iterator to point to the same value as `x`.

### Member Operators

    raw_storage_iterator <OutputIterator, T>&
    operator=(const T& element);

Constructs, using a placement `operator new,` an instance of `T`, initialized to the value `element`, at the location pointed to by the iterator.

    raw_storage_iterator<OutputIterator,T>&
    operator*();

Returns `*this`.

    raw_storage_iterator&
    operator++();

Pre-increment: advances the iterator and returns a reference to the updated iterator.

    raw_storage_iterator
    operator++(int);

Post-increment: advances the iterator and returns the old value of the iterator.

### Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 20.4.2