[back.insert.iterator]

# 24 Iterators library [[iterators]](./#iterators)

## 24.5 Iterator adaptors [[predef.iterators]](predef.iterators#back.insert.iterator)

### 24.5.2 Insert iterators [[insert.iterators]](insert.iterators#back.insert.iterator)

#### 24.5.2.2 Class template back_insert_iterator [back.insert.iterator]

#### [24.5.2.2.1](#back.insert.iter.general) General [[back.insert.iter.general]](back.insert.iter.general)

[ð](#lib:back_insert_iterator)

namespace std {template<class Container>class back_insert_iterator {protected: Container* container; public:using iterator_category = output_iterator_tag; using value_type = void; using difference_type = ptrdiff_t; using pointer = void; using reference = void; using container_type = Container; constexpr explicit back_insert_iterator(Container& x); constexpr back_insert_iterator& operator=(const typename Container::value_type& value); constexpr back_insert_iterator& operator=(typename Container::value_type&& value); constexpr back_insert_iterator& operator*(); constexpr back_insert_iterator& operator++(); constexpr back_insert_iterator operator++(int); };}

#### [24.5.2.2.2](#back.insert.iter.ops) Operations [[back.insert.iter.ops]](back.insert.iter.ops)

[ð](#lib:back_insert_iterator,constructor)

`constexpr explicit back_insert_iterator(Container& x);
`

[1](#back.insert.iter.ops-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L3863)

*Effects*: Initializescontainer with addressof(x)[.](#back.insert.iter.ops-1.sentence-1)

[ð](#lib:operator=,back_insert_iterator)

`constexpr back_insert_iterator& operator=(const typename Container::value_type& value);
`

[2](#back.insert.iter.ops-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L3876)

*Effects*: As if by: container->push_back(value);

[3](#back.insert.iter.ops-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L3880)

*Returns*: *this[.](#back.insert.iter.ops-3.sentence-1)

[ð](#lib:operator=,back_insert_iterator_)

`constexpr back_insert_iterator& operator=(typename Container::value_type&& value);
`

[4](#back.insert.iter.ops-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L3891)

*Effects*: As if by: container->push_back(std​::​move(value));

[5](#back.insert.iter.ops-5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L3895)

*Returns*: *this[.](#back.insert.iter.ops-5.sentence-1)

[ð](#lib:operator*,back_insert_iterator)

`constexpr back_insert_iterator& operator*();
`

[6](#back.insert.iter.ops-6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L3906)

*Returns*: *this[.](#back.insert.iter.ops-6.sentence-1)

[ð](#lib:operator++,back_insert_iterator)

`constexpr back_insert_iterator& operator++();
constexpr back_insert_iterator  operator++(int);
`

[7](#back.insert.iter.ops-7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L3918)

*Returns*: *this[.](#back.insert.iter.ops-7.sentence-1)

#### [24.5.2.2.3](#back.inserter) back_inserter [[back.inserter]](back.inserter)

[ð](#lib:back_inserter)

`template<class Container>
  constexpr back_insert_iterator<Container> back_inserter(Container& x);
`

[1](#back.inserter-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L3932)

*Returns*: back_insert_iterator<Container>(x)[.](#back.inserter-1.sentence-1)
