STD::FRONT_INSERT_ITERATOR(3cxx)
Bestie, welcome to the manual page for std::front_insert_iterator< _Container >. The manual name up top is literally std::front_inse...r< _Container >(3cxx) β truncated like a text from a dying phone, but we move. This iterator is lowkey iconic: it turns assignment into insertion. Periodt.
πΈ NAME πΈ
std::front_insert_iterator< _Container > β Turns assignment into insertion.
β¨ SYNOPSIS β¨
Start here, bestie:
#include <iterator>
It inherits std::iterator< output_iterator_tag, void, void, void, void >. Slay.
π Public Types π
typedef _Container container_typeβ a nested typedef for the type of whatever container you used. Literally the container type, serving as itself.using difference_type = ptrdiff_tβ no little description attached in the source; she's just here, existing.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.constexpr front_insert_iterator & operator* ()β simply returns*this.constexpr front_insert_iterator & operator++ ()β simply returns*this. (This iterator does not move.)constexpr front_insert_iterator operator++ (int)β simply returns*this. (This iterator does not move.)constexpr front_insert_iterator & operator= (const typename _Container::value_type &__value)β the const lvalue assignment vibe.constexpr front_insert_iterator & operator= (typename _Container::value_type &&__value)β the rvalue assignment vibe, listed right after.
π¦ Protected Attributes π¦
_Container * containerβ protected container pointer. She's in the protected girlies.
π Detailed Description π
template<typename _Container> class std::front_insert_iterator< _Container > β the source literally says "Turns assignment into insertion." with a stray quote mark doing its own thing, but the vibe is clear.
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. Bestie, take the shortcut. π
π§ Member Typedef Documentation π§
π container_type
template<typename _Container > typedef _Container
std::front_insert_iterator< _Container >::container_type
A nested typedef for the type of whatever container you used.
π iterator_category [inherited]
typedef output_iterator_tag std::iterator< output_iterator_tag , void , void , void , void >::iterator_category [inherited]
One of the tag types.
π pointer [inherited]
typedef void std::iterator< output_iterator_tag , void , void , void , void >::pointer [inherited]
This type represents a pointer-to-value_type.
π reference [inherited]
typedef void std::iterator< output_iterator_tag , void , void , void , void >::reference [inherited]
This type represents a reference-to-value_type.
π value_type [inherited]
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 > constexpr std::front_insert_iterator<
_Container >::front_insert_iterator (_Container & __x) [inline],
[explicit], [constexpr]
The only way to create this iterator is with a container.
π₯ Member Function Documentation π₯
β operator* ()
template<typename _Container > constexpr front_insert_iterator &
std::front_insert_iterator< _Container >::operator* () [inline],
[constexpr]
Simply returns *this.
β operator++ ()
template<typename _Container > constexpr front_insert_iterator &
std::front_insert_iterator< _Container >::operator++ () [inline],
[constexpr]
Simply returns *this. (This iterator does not move.)
β operator++ (int)
template<typename _Container > constexpr front_insert_iterator
std::front_insert_iterator< _Container >::operator++ (int) [inline],
[constexpr]
Simply returns *this. (This iterator does not move.)
β operator=
template<typename _Container > constexpr 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-const T forcontainer<T>.
Returns
- This iterator, for chained operations.
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.
The rvalue operator= from the public list above doesn't get its own detailed block on this page β the page only spells out the const lvalue one in the Member Function Documentation. That's the source's choice, not mine. π
π Author π
Generated automatically by Doxygen for libstdc++ from the source code.
Sign-off π«Ά Source/version vibe: libstdc++, Doxygen-generated from the source code. Footer energy: libststd::front_inse...r< _Container >(3cxx). Date: not separately shown on this page, bestie β I'm not inventing one, no cap. Bye, go prepend something cute. π
β¨
π¦ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms