[front.insert.iterator]

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

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

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

#### 24.5.2.3 Class template front_insert_iterator [front.insert.iterator]

#### [24.5.2.3.1](#front.insert.iter.general) General [[front.insert.iter.general]](front.insert.iter.general)

[ð](#lib:front_insert_iterator)

namespace std {template<class Container>class front_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 front_insert_iterator(Container& x); constexpr front_insert_iterator& operator=(const typename Container::value_type& value); constexpr front_insert_iterator& operator=(typename Container::value_type&& value); constexpr front_insert_iterator& operator*(); constexpr front_insert_iterator& operator++(); constexpr front_insert_iterator operator++(int); };}

#### [24.5.2.3.2](#front.insert.iter.ops) Operations [[front.insert.iter.ops]](front.insert.iter.ops)

[ð](#lib:front_insert_iterator,constructor)

`constexpr explicit front_insert_iterator(Container& x);
`

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

`constexpr front_insert_iterator& operator*();
`

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

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

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

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

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

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

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

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

#### [24.5.2.3.3](#front.inserter) front_inserter [[front.inserter]](front.inserter)

[ð](#lib:front_inserter)

`template<class Container>
  constexpr front_insert_iterator<Container> front_inserter(Container& x);
`

[1](#front.inserter-1)

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

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