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 type container_type::const_reference is; presumably a reference-to-const T for container<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