STD::BACK_INSERT_ITERATOR(3)
β¨ NAME β¨
std::back_insert_iterator< _Container > β turns assignment into insertion π
no cap
This one lives in the Library Functions Manual, bestie, so you know it's the real deal.
π¦ SYNOPSIS π¦
#include <iterator>
It inherits std::iterator< output_iterator_tag, void, void, void, void >. Periodt.
π Public Types π
typedef _Container container_typeβ a nested typedef for the type of whatever container you used. whatever you brought to the function, basically π«Άusing difference_typeβ that's it. that's the whole thing. no blurb provided, she's just there being iconic π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 back_insert_iterator (_Container &__x)β the only way to create this iterator is with a container. that's the whole vibe. no container, no iterator, sorry π₯²constexpr back_insert_iterator & operator* ()β simply returns*this. literally just hands you back herself. queen behaviour πconstexpr back_insert_iterator & operator++ ()β simply returns*this. (This iterator does not move.) β yes bestie she does NOT move, that's not a bug that's the whole point πconstexpr back_insert_iterator operator++ (int)β simply returns*this. (This iterator does not move.) β same energy, postfix flavour β¨constexpr back_insert_iterator & operator= (const typename _Container::value_type &__value)constexpr back_insert_iterator & operator= (typename _Container::value_type &&__value)
π Protected Attributes π
_Container * container
π Detailed Description π
template<typename _Container>
class std::back_insert_iterator< _Container >
Turns assignment into insertion. πͺ
These are output iterators, constructed from a container-of-T. Assigning a T to the iterator appends it to the container using push_back. so like, you're not picking a spot, you're just yeeting stuff onto the end, and honestly? valid.
Tip: Using the back_inserter function to create these iterators can save typing. fr fr, save your fingers π«Ά
πΈ Member Typedef Documentation πΈ
template<typename _Container> typedef _Container std::back_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::back_insert_iterator< _Container >::back_insert_iterator (_Container & __x)[inline], [explicit], [constexpr] β the only way to create this iterator is with a container. (yes, she said what she said the first time too.)
References std::__addressof().
π Member Function Documentation π
template<typename _Container> back_insert_iterator & std::back_insert_iterator< _Container >::operator* ()[inline], [nodiscard], [constexpr] β simply returns*this.template<typename _Container> back_insert_iterator & std::back_insert_iterator< _Container >::operator++ ()[inline], [constexpr] β simply returns*this. (This iterator does not move.).template<typename _Container> back_insert_iterator std::back_insert_iterator< _Container >::operator++ (int )[inline], [constexpr] β simply returns*this. (This iterator does not move.).template<typename _Container> back_insert_iterator & std::back_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. slay, chain away π
This kind of iterator doesn't really have a position in the container (you can think of the position as being permanently at the end, if you like). Assigning a value to the iterator will always append the value to the end of the container. always. every time. no exceptions bestie, that's just who she is π
π Author π
Generated automatically by Doxygen for libstdc++ from the source code.
okay that's the whole page bestie!! π go forth and push_back responsibly β¨ β this cutie was brought to you by libstdc++, page 3 of the Library Functions Manual, and she ate, no crumbs left πΈπ¦π
π¦ 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