STD::_LIST_ITERATOR(3)

πŸ’– std::_List_iterator< _Tp > πŸ’–

okay bestie, welcome to the libstdc++ manual page for std::_List_iterator< _Tp > β€” she's a list::iterator, she's iconic, she lives in <list>, and she is literally just vibing in the standard library waiting for you to walk her through your linked list. no cap. πŸ¦‹


✨ NAME ✨

std::_List_iterator< _Tp > β€” a list::iterator. that's it, that's the whole job description. she iterates. periodt. πŸ’…


🌸 SYNOPSIS 🌸

#include <list>

πŸŽ€ Public Types πŸŽ€

bestie she has a whole wardrobe of typedefs, and every single one of them is serving exactly what it's supposed to:

  • typedef _List_node< _Tp > _Node β€” the node type she's cruising around on. her ride. her little home base. 🏠
  • typedef ptrdiff_t difference_type β€” the signed integer type for measuring distance between iterators. yes, ptrdiff_t, the classic. πŸ“
  • typedef std::bidirectional_iterator_tag iterator_category β€” and THIS is the important one, because she's tagged bidirectional_iterator_tag, meaning she can walk forward AND backward. two directions. main character energy fr fr. πŸ”₯
  • typedef _Tp * pointer β€” pointer to the element type. _Tp *. as promised. ✨
  • typedef _Tp & reference β€” reference to the element type. _Tp &. matching set, obsessed. πŸ’œ
  • typedef _Tp value_type β€” the actual element type being stored. the whole point of the operation. πŸ‘‘

🫢 Public Member Functions 🫢

every single one of these is noexcept, which means she is NOT going to throw at you. she's chill like that. 😌

  • _List_iterator (__detail::_List_node_base *__x) noexcept β€” constructor bestie!! hand her a __detail::_List_node_base * named __x and she'll wrap herself around it. that's the whole construction arc. πŸ’–
  • _List_iterator _M_const_cast () const noexcept β€” internal magic (that _M_ prefix is the giveaway, iykyk) that hands you back a _List_iterator from a const context. she's a const member function, and she does not throw. 🧚
  • reference operator* () const noexcept β€” the dereference glow-up!! gives you a reference to the thing she's pointing at. const, and yes, noexcept. ⭐
  • _List_iterator & operator++ () const noexcept β€” wait bestie, read that again, it's a const member function that returns _List_iterator &. pre-increment!! move forward, return yourself. slay. ✨
  • _List_iterator operator++ (int) noexcept β€” post-increment!! that lonely int parameter is the classic dummy argument that exists purely so the compiler can tell the two ++ versions apart. she returns a _List_iterator by value β€” the old position, preserved like a little polaroid. πŸ“Έ
  • _List_iterator & operator-- () const noexcept β€” pre-decrement!! going backwards, also a const member function, also returns _List_iterator &. bidirectional, remember? told you. 🌈
  • _List_iterator operator-- (int) noexcept β€” post-decrement, same int dummy-argument trick, returns the pre-decrement copy by value. iconic behaviour, honestly. πŸŽ€
  • pointer operator-> () const noexcept β€” the arrow!! gives you a pointer so you can reach straight through to a member. const, noexcept, perfect. πŸ’…

🌟 Public Attributes 🌟

just one, and she's doing a LOT of heavy lifting:

  • __detail::_List_node_base * _M_node β€” the raw pointer to the node base. this is the whole entire state of the iterator. everything above is just choreography around this one pointer. respect her. πŸ™ˆ

πŸ’ž Friends πŸ’ž

  • bool operator== (const _List_iterator &__x, const _List_iterator &__y) noexcept β€” equality comparison between two iterators, taking __x and __y, returning bool, and (say it with me) noexcept. friendship means she gets to peek at your privates. that's the C++ way. πŸ’–

πŸ¦‹ Detailed Description πŸ¦‹

template<typename _Tp>
    struct std::_List_iterator< _Tp >

"A list::iterator.

All the functions are op overloads."

yeah. that's the whole thing. all the functions are op overloads β€” every single member function up there is an operator overload. *, ++, --, ->, all of it. she doesn't have a personality beyond operators, and honestly? she doesn't need one. she ate and left no crumbs. πŸ‘‘


✍️ Author ✍️

Generated automatically by Doxygen for libstdc++ from the source code. so like, no human wrote this by hand β€” Doxygen did it, machine-style, no cap. πŸ€–βœ¨


bestie quick recap so you don't forget: #include <list>, bidirectional, noexcept everything, one single _M_node attribute holding the whole vibe together, and a friend operator==. that's her. that's the iterator. πŸ’œ

okay that's a wrap!! this page came to you from libstdc++ (the library, not a date β€” the footer's just repping the source, she's timeless like that πŸ’…) and yes, the footer also says std::_List...tor< _Tp >(3) because the title got truncated on the way out, and honestly? relatable. mwah. πŸ˜˜πŸŽ€

πŸ“¦ 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