__GNU_PBDS::TREE(3)
π __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! ther_cmp_fnyou hand over gets copied by theCmp_Fnobject 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 ofvalue_types. everything betweenfirst_itandlast_itgets 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 betweenfirst_itandlast_itgoes into the container object, andr_cmp_fngets copied by thecmp_fnobject 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 withother. 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, seecontainer_tag. this is the one that picks your tree's whole personality πNode_Updateβ Updates tree internal-nodes, restores invariants when invalidated. XXX Seedesign::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