---
name: "__gnu_pbds::trie"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_pbds::trie"
---

# \_\_gnu\_pbds::trie(3)

## NAME

\_\_gnu\_pbds::trie\< Key, Mapped, \_ATraits, Tag, Node\_Update, \_Alloc \>

## SYNOPSIS

\#include \<assoc\_container.hpp\>

Inherits **\_\_gnu\_pbds::basic\_branch\< Key, Mapped, Tag, Node\_Update, Policy\_Tl, \_Alloc \>**.

### Public Types

typedef \_ATraits **access\_traits**\
 Element access traits type.  typedef Node\_Update **node\_update**\

### Public Member Functions

**trie** (const **access\_traits** &t)\
 Constructor taking some policy objects. r\_access\_traits will be copied by the \_ATraits object of the container object.  **trie** (const trie &other)\
 template\<typename It\> **trie** (It first, It last)\
 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.  template\<typename It\> **trie** (It first, It last, const **access\_traits** &t)\
 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.  trie & **operator=** (const trie &other)\
 void **swap** (trie &other)\

## Detailed Description

### template\<typename Key, typename Mapped, typename \_ATraits = typename detail::default\_trie\_access\_traits\<Key\>::type, typename Tag = pat\_trie\_tag, template\< typename Node\_CItr, typename Node\_Itr, typename \_ATraits\_, typename \_Alloc\_ \> class Node\_Update = null\_node\_update, typename \_Alloc = std::allocator\<char\>\>

class \_\_gnu\_pbds::trie\< Key, Mapped, \_ATraits, Tag, Node\_Update, \_Alloc \>"A trie-based container.

**Template Parameters**

*Key* Key type. \
 *Mapped* Map type. \
 *\_ATraits* Element access traits. \
 *Tag* Instantiating data structure type, see container\_tag. \
 *Node\_Update* Updates trie internal-nodes, restores invariants when invalidated. XXX See design::tree-based-containersnode invariants. \
 *\_Alloc* Allocator type.

Base tag choice is pat\_trie\_tag.

Base is basic\_branch.

## Member Typedef Documentation

### template\<typename Key, typename Mapped, typename \_ATraits = typename detail::default\_trie\_access\_traits\<Key\>::type, typename Tag = pat\_trie\_tag, template\< typename Node\_CItr, typename Node\_Itr, typename \_ATraits\_, typename \_Alloc\_ \> class Node\_Update = null\_node\_update, typename \_Alloc = std::allocator\<char\>\> typedef \_ATraits \_\_gnu\_pbds::trie\< Key, Mapped, \_ATraits, Tag, Node\_Update, \_Alloc \>::access\_traits

Element access traits type.

## Constructor & Destructor Documentation

### template\<typename Key, typename Mapped, typename \_ATraits = typename detail::default\_trie\_access\_traits\<Key\>::type, typename Tag = pat\_trie\_tag, template\< typename Node\_CItr, typename Node\_Itr, typename \_ATraits\_, typename \_Alloc\_ \> class Node\_Update = null\_node\_update, typename \_Alloc = std::allocator\<char\>\> \_\_gnu\_pbds::trie\< Key, Mapped, \_ATraits, Tag, Node\_Update, \_Alloc \>::trie (const access\_traits & t) \[inline\]

Constructor taking some policy objects. r\_access\_traits will be copied by the \_ATraits object of the container object.

### template\<typename Key, typename Mapped, typename \_ATraits = typename detail::default\_trie\_access\_traits\<Key\>::type, typename Tag = pat\_trie\_tag, template\< typename Node\_CItr, typename Node\_Itr, typename \_ATraits\_, typename \_Alloc\_ \> class Node\_Update = null\_node\_update, typename \_Alloc = std::allocator\<char\>\> template\<typename It\> \_\_gnu\_pbds::trie\< Key, Mapped, \_ATraits, Tag, Node\_Update, \_Alloc \>::trie (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.

### template\<typename Key, typename Mapped, typename \_ATraits = typename detail::default\_trie\_access\_traits\<Key\>::type, typename Tag = pat\_trie\_tag, template\< typename Node\_CItr, typename Node\_Itr, typename \_ATraits\_, typename \_Alloc\_ \> class Node\_Update = null\_node\_update, typename \_Alloc = std::allocator\<char\>\> template\<typename It\> \_\_gnu\_pbds::trie\< Key, Mapped, \_ATraits, Tag, Node\_Update, \_Alloc \>::trie (It first, It last, const access\_traits & t) \[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.

## Author

Generated automatically by Doxygen for libstdc++ from the source code.
