# `basic_tree` Interface

An abstract basic tree-like-based associative container.

Defined in: `assoc_container.hpp`

## Template Parameters

Parameter | Description | Default Value

    typename Key

Key type.

-

    typename Mapped

Mapped type.

-

    class Tag

Mapped-structure tag.

-

    class Node_Update

Node updater.

Restores node-invariants when invalidated.

-

    class Policy_Tl

Policy typelist.

Contains subclasses' policies.

-

    class Allocator

Allocator type.

-

## Base Classes

Class | Derivation Type

    Node_Update

public

    container_base

public

## Public Types and Constants

### Key-Type Definitions

Type | Definition | Description

    const_key_reference

    typename container_base::const_key_reference

Const key reference type.

### Policy Definitions

Type | Definition | Description

    node_update

    Node_Update

Node updater type.

### Iterator Definitions

Type | Definition | Description

    const_iterator

    typename container_base::const_iterator

Const range-type iterator.

    iterator

    typename container_base::iterator

Range-type iterator.

    const_reverse_iterator

    Const reverse range-type iterator.

Const reverse range-type `iterator`.

    reverse_iterator

    Reverse range-type iterator.

    If Mapped is null_mapped_type, then this is synonymous to const_reverse_iterator

Reverse range-type `iterator`.

## Public Methods

### Constructors, Destructor, and Related

Method | Description

    virtual
      ~basic_tree
      ()

Destructor.

### Policy Access Methods

Method | Description

    node_update &
      get_node_update
      ()

Access to the `node_update` object.

    const node_update &
      get_node_update
      () const

Const access to the `node_update` object.

### Find Methods

Method | Description

    iterator
      lower_bound
      (const_key_reference r_key)

Returns an `iterator` corresponding to the entry whose key is the smallest one at least as large as `r_key`.

    const_iterator
      lower_bound
      (const_key_reference r_key) const

Returns a `const` `iterator` corresponding to the entry whose key is the smallest one at least as large as `r_key`.

    iterator
      upper_bound
      (const_key_reference r_key)

Returns an `iterator` corresponding to the entry whose key is the smallest one larger than `r_key`.

    const_iterator
      upper_bound
      (const_key_reference r_key) const

Returns a `const_iterator` corresponding to the entry whose key is the smallest one larger than `r_key`.

### Erase Methods

Method | Description

    iterator
      erase
      (iterator it)

Erases the value_type corresponding to the `iterator` `it`. Returns the `iterator` corresponding to the next value_type.

    reverse_iterator
      erase
      (reverse_iterator it)

Erases the value_type corresponding to the `reverse_iterator` `it`. Returns the `reverse_iterator` corresponding to the previous value_type.

### Iteration Methods

Method | Description

    reverse_iterator
      rbegin
      ()

Returns a `reverse_iterator` corresponding to the last value_type in the container.

    const_reverse_iterator
      rbegin
      () const

Returns a `const_reverse_iterator` corresponding to the last value_type in the container.

    reverse_iterator
      rend
      ()

Returns a `reverse_iterator` corresponding to the just-before-first value_type in the container.

    const_reverse_iterator
      rend
      () const

Returns a `const_reverse_iterator` corresponding to the just-before-first value_type in the container.

### Split and join Methods

Method | Description

    void
      join
      (basic_tree &other)

Joins two trees. When this function returns, `other` will be empty.

When calling this method, `other`'s keys must be all larger or all smaller than this object's keys, and `other`'s policies must be equivalent to this object's policies.

    void
      split
      (const_key_reference r_key,
        basic_tree &other)

Splits into two trees. When this function returns, `other` will contain only keys larger than `r_key`.

When calling this method, `other`'s policies must be equivalent to this object's policies.