STD::FRONT_INSERT_ITERATOR(3)
π std::front_insert_iterator< _Container > β from the Library Functions Manual (section 3) π
okay bestie, sit down, hydrate, and let me tell you about the iterator that just inserts at the front like it owns the place π
β¨ NAME β¨
std::front_insert_iterator< _Container > β turns assignment into insertion. that's it, that's the whole job, and she does it flawlessly π
πΈ SYNOPSIS πΈ
#include <iterator>
Inherits std::iterator< output_iterator_tag, void, void, void, void >.
π Public Types π
typedef _Container container_typeβ a nested typedef for the type of whatever container you used.using difference_typeβ yep, she's there.typedef output_iterator_tag iterator_categoryβ one of the tag types.typedef void pointerβ this type represents a pointer-to-value_type.typedef void referenceβ this type represents a reference-to-value_type.typedef void value_typeβ the type "pointed to" by the iterator.
π Public Member Functions π
constexpr front_insert_iterator (_Container &__x)β the only way to create this iterator is with a container. no container, no iterator, no exceptions.constexpr front_insert_iterator & operator* ()β simply returns*this.constexpr front_insert_iterator & operator++ ()β simply returns*this. (this iterator does not move.) π iconic behaviour honestlyconstexpr front_insert_iterator operator++ (int)β simply returns*this. (this iterator does not move.) still not moving. still slaying.constexpr front_insert_iterator & operator= (const typename _Container::value_type &__value)constexpr front_insert_iterator & operator= (typename _Container::value_type &&__value)
π Protected Attributes π
_Container * container
π¦ Detailed Description π¦
template<typename _Container>
class std::front_insert_iterator< _Container >
Turns assignment into insertion.
These are output iterators, constructed from a container-of-T. Assigning a T to the iterator prepends it to the container using push_front. π«Ά
Tip: using the front_inserter function to create these iterators can save typing. your fingers will thank you.
β Member Typedef Documentation β
template<typename _Container>
typedef _Container std::front_insert_iterator< _Container >::container_type
A nested typedef for the type of whatever container you used.
typedef output_iterator_tag
std::iterator< output_iterator_tag, void, void, void, void >::iterator_category
[inherited]
One of the tag types.
typedef void
std::iterator< output_iterator_tag, void, void, void, void >::pointer
[inherited]
This type represents a pointer-to-value_type.
typedef void
std::iterator< output_iterator_tag, void, void, void, void >::reference
[inherited]
This type represents a reference-to-value_type.
typedef void
std::iterator< output_iterator_tag, void, void, void, void >::value_type
[inherited]
The type "pointed to" by the iterator.
π Constructor & Destructor Documentation π
template<typename _Container>
std::front_insert_iterator< _Container >::front_insert_iterator (_Container & __x)
[inline], [explicit], [constexpr]
The only way to create this iterator is with a container.
References std::__addressof().
π₯ Member Function Documentation π₯
template<typename _Container>
front_insert_iterator &
std::front_insert_iterator< _Container >::operator* ()
[inline], [nodiscard], [constexpr]
Simply returns *this.
template<typename _Container>
front_insert_iterator &
std::front_insert_iterator< _Container >::operator++ ()
[inline], [constexpr]
Simply returns *this. (This iterator does not move.)
template<typename _Container>
front_insert_iterator
std::front_insert_iterator< _Container >::operator++ (int )
[inline], [constexpr]
Simply returns *this. (This iterator does not move.)
template<typename _Container>
front_insert_iterator &
std::front_insert_iterator< _Container >::operator= (const typename _Container::value_type & __value)
[inline], [constexpr]
Parameters
__valueβ an instance of whatever typecontainer_type::const_referenceis; presumably a reference-to-constTforcontainer<T>.
Returns
- this iterator, for chained operations. chain her up, she's ready π«Ά
This kind of iterator doesn't really have a position in the container (you can think of the position as being permanently at the front, if you like). Assigning a value to the iterator will always prepend the value to the front of the container. main character energy: always first, never moves. periodt. π β¨
π Author π
Generated automatically by Doxygen for libstdc++ from the source code.
okay that's the whole vibe check, bestie π this page is part of the libstdc++ manual, section 3 (Library Functions Manual), and it was generated for that libstdc++ source β mwah, go forth and push_front responsibly ππ¦πΈ
π¦ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms