back_insert_iterator
namespace opentl {
template <typename Container>
class back_insert_iterator;
}
An output iterator that appends elements to a container.
Declared in <iterator/back_insert_iterator.hpp>.
Template Parameters
| Name |
Description |
Container |
The container type. |
Member Types
| Type |
Description |
container_type |
The container type. |
value_type |
The value type. |
difference_type |
The difference type. |
pointer |
The pointer type, output iterators are not dereferenceable to a pointer. |
reference |
The reference type, output iterators are not dereferenceable to a value. |
iterator_category |
The iterator category. |
Member Functions
| Name |
Return Type |
Description |
back_insert_iterator(container_type) |
|
back_insert_iterator constructor. |
operator=(const value_type&) |
back_insert_iterator& |
Appends a copy of the value to the container. |
operator=(value_type&&) |
back_insert_iterator& |
Appends the value to the container. |
operator*() |
back_insert_iterator& |
Returns a reference to the iterator. |
operator++() |
back_insert_iterator& |
Returns a reference to the iterator. |
operator++(int) |
back_insert_iterator |
Returns a copy of the iterator. |
Non-member Functions
| Name |
Return Type |
Description |
back_inserter(container) |
back_insert_iterator<Container> |
Creates a back_insert_iterator that appends to the container. |
Example
#include <opentl/iterator.hpp>
struct queue {
using value_type = int;
void push_back(const int&);
void push_back(int&&);
};
int main() {
queue values;
auto it = opentl::back_inserter(values);
*it = 1;
*it = 2;
}