__GNU_PBDS::TREE(3)

πŸ“¦
version 16.2.1+r23+gd564253eb6c8 Β· 6 versions
, in arch rolling, fedora 44

πŸ’– __gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag, Node_Update, _Alloc > πŸ’–

okay bestie so this is a page from the Library Functions Manual for libstdc++, section 3, and it's about the most ✨aesthetic✨ tree container GNU ever handed us. sit down, hydrate, let's get into it 🫢


🌸 NAME 🌸

__gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag, Node_Update, _Alloc > β€” that's the whole name, that's the whole vibe, no notes πŸ’…


✨ SYNOPSIS ✨

#include <assoc_container.hpp>

it inherits from:

__gnu_pbds::basic_branch< Key, Mapped, Tag, Node_Update, Policy_Tl, _Alloc >

like. it's giving "I am a whole tree and I know it" πŸ’€


πŸŽ€ Public Types πŸŽ€

  • typedef Cmp_Fn cmp_fn β€” bestie this is literally just the comparison functor type, the thing that decides what comes before what πŸ‘‘
  • typedef Node_Update node_update β€” the node update type, no extra lore given, that's it, that's the tea πŸ“

🌸 Public Member Functions 🌸

  • tree (const cmp_fn &c) β€” constructor that takes some policy objects! the r_cmp_fn you hand over gets copied by the Cmp_Fn object of the container object. yes girl, copied. 🫢
  • tree (const tree &other) β€” the classic copy constructor, stealing your whole vibe (affectionately) πŸ¦‹
  • template<typename It> tree (It first, It last) β€” constructor taking __iterators to a range of value_types. everything between first_it and last_it gets inserted into the container object. slay. ✨
  • template<typename It> tree (It first, It last, const cmp_fn &c) β€” same range situation but now with policy objects too πŸŽ€ everything between first_it and last_it goes into the container object, and r_cmp_fn gets copied by the cmp_fn object of the container object. two-for-one, iconic.
  • tree & operator= (const tree &other) β€” assignment operator, the "you're me now" moment 😭
  • void swap (tree &other) β€” swap the contents with other. trade. exchange. mutual glow-up. πŸ”₯

πŸ’« Detailed Description πŸ’«

okay here's the actual signature, verbatim, no cap:

template<typename Key, typename Mapped, typename Cmp_Fn = std::less<Key>,
    typename Tag = rb_tree_tag, template< typename Node_CItr, typename
    Node_Itr, typename Cmp_Fn_, typename _Alloc_ > class Node_Update =
    null_node_update, typename _Alloc = std::allocator<char>>
class __gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag, Node_Update, _Alloc >

and the description, and I quote: "A tree-based container." that's it. that's the whole description. absolute main character energy, said four words and left πŸ’…


🧚 Template Parameters 🧚

  • Key β€” Key type. the actual key bestie πŸ”‘
  • Mapped β€” Map type. the thing being mapped πŸ—ΊοΈ
  • Cmp_Fn β€” Comparison functor. the referee of ordering ⭐
  • Tag β€” Instantiating data structure type, see container_tag. this is the one that picks your tree's whole personality πŸŽ€
  • Node_Update β€” Updates tree internal-nodes, restores invariants when invalidated. XXX See design::tree-based-containersnode invariants. ⚠️
  • _Alloc β€” Allocator type. handles the memory bag πŸ’œ

Base tag choices are: ov_tree_tag, rb_tree_tag, splay_tree_tag.

and the base is basic_branch. periodt. πŸ‘‘


πŸ“Ž Member Typedef Documentation πŸ“Ž

so for this whole template situation:

template<typename Key, typename Mapped, typename Cmp_Fn = std::less<Key>,
    typename Tag = rb_tree_tag, template< typename Node_CItr, typename
    Node_Itr, typename Cmp_Fn_, typename _Alloc_ > class Node_Update =
    null_node_update, typename _Alloc = std::allocator<char>>
typedef Cmp_Fn __gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag, Node_Update, _Alloc >::cmp_fn

cmp_fn β€” Comparison functor type. and that's the whole note. she's brief, she's efficient, we love her πŸ’–


πŸ”₯ Constructor & Destructor Documentation πŸ”₯

🫢 tree (const cmp_fn & c) β€” [inline]

full signature, exactly:

template<typename Key, typename Mapped, typename Cmp_Fn = std::less<Key>,
    typename Tag = rb_tree_tag, template< typename Node_CItr, typename
    Node_Itr, typename Cmp_Fn_, typename _Alloc_ > class Node_Update =
    null_node_update, typename _Alloc = std::allocator<char>>
__gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag, Node_Update, _Alloc >::tree
(const cmp_fn & c) [inline]

Constructor taking some policy objects. r_cmp_fn will be copied by the Cmp_Fn object of the container object. πŸ’…

πŸ¦‹ tree (It first, It last) β€” [inline]

template<typename Key, typename Mapped, typename Cmp_Fn = std::less<Key>,
    typename Tag = rb_tree_tag, template< typename Node_CItr, typename
    Node_Itr, typename Cmp_Fn_, typename _Alloc_ > class Node_Update =
    null_node_update, typename _Alloc = std::allocator<char>>
template<typename It> __gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag,
Node_Update, _Alloc >::tree (It first, It last) [inline]

Constructor taking __iterators to a range of value_types. The value_types between first_it and last_it will be inserted into the container object. inserting. slaying. same thing. ✨

πŸŽ€ tree (It first, It last, const cmp_fn & c) β€” [inline]

template<typename Key, typename Mapped, typename Cmp_Fn = std::less<Key>,
    typename Tag = rb_tree_tag, template< typename Node_CItr, typename
    Node_Itr, typename Cmp_Fn_, typename _Alloc_ > class Node_Update =
    null_node_update, typename _Alloc = std::allocator<char>>
template<typename It> __gnu_pbds::tree< Key, Mapped, Cmp_Fn, Tag,
Node_Update, _Alloc >::tree (It first, It last, const cmp_fn & c)
[inline]

Constructor taking __iterators to a range of value_types and some policy objects. The value_types between first_it and last_it will be inserted into the container object. r_cmp_fn will be copied by the cmp_fn object of the container object. two jobs, one constructor, she's booked and busy πŸ˜­πŸ’–


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. so like, a robot wrote this about a robot-built tree, and honestly? we stan a transparent origin story 🌈


okay bestie that's the whole page, no facts left behind, every signature intact, every default preserved 🫢 this manual page came from libstdc++ and was lovingly auto-generated by Doxygen straight from the source code β€” so if anything's weird in here, blame the source, not me πŸ’…βœ¨

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