LLVM 24.0.0git
llvm::EytzingerTable< T > Class Template Reference

Owning container that stores elements in a complete binary search tree formatted in Eytzinger (breadth-first) order. More...

#include "llvm/ADT/Eytzinger.h"

Public Types

using iterator = typename std::vector<T>::const_iterator
using const_iterator = typename std::vector<T>::const_iterator

Public Member Functions

 EytzingerTable ()=default
EytzingerTableSpan< TasSpan () const
template<typename KeyT = T>
std::optional< size_tfindIndex (const KeyT &Target) const
template<typename KeyT = T>
bool contains (const KeyT &Target) const
bool isSorted () const
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
const Tdata () const
size_t size () const
bool empty () const
const Toperator[] (size_t Idx) const

Static Public Member Functions

template<typename KeyT = T>
static EytzingerTable< Tcreate (std::vector< KeyT > Keys)
 Construct an Eytzinger search tree from a vector of keys by sorting, deduplicating, and reordering elements into breadth-first layout.

Detailed Description

template<typename T>
class llvm::EytzingerTable< T >

Owning container that stores elements in a complete binary search tree formatted in Eytzinger (breadth-first) order.

Definition at line 123 of file Eytzinger.h.

Member Typedef Documentation

◆ const_iterator

template<typename T>
using llvm::EytzingerTable< T >::const_iterator = typename std::vector<T>::const_iterator

Definition at line 130 of file Eytzinger.h.

◆ iterator

template<typename T>
using llvm::EytzingerTable< T >::iterator = typename std::vector<T>::const_iterator

Definition at line 129 of file Eytzinger.h.

Constructor & Destructor Documentation

◆ EytzingerTable()

template<typename T>
llvm::EytzingerTable< T >::EytzingerTable ( )
default

Referenced by create().

Member Function Documentation

◆ asSpan()

template<typename T>
EytzingerTableSpan< T > llvm::EytzingerTable< T >::asSpan ( ) const
inlinenodiscard

Definition at line 156 of file Eytzinger.h.

Referenced by contains(), findIndex(), and isSorted().

◆ begin() [1/2]

template<typename T>
iterator llvm::EytzingerTable< T >::begin ( )
inlinenodiscard

Definition at line 172 of file Eytzinger.h.

◆ begin() [2/2]

template<typename T>
const_iterator llvm::EytzingerTable< T >::begin ( ) const
inlinenodiscard

Definition at line 173 of file Eytzinger.h.

◆ contains()

template<typename T>
template<typename KeyT = T>
bool llvm::EytzingerTable< T >::contains ( const KeyT & Target) const
inlinenodiscard

Definition at line 166 of file Eytzinger.h.

References asSpan().

◆ create()

template<typename T>
template<typename KeyT = T>
EytzingerTable< T > llvm::EytzingerTable< T >::create ( std::vector< KeyT > Keys)
inlinestatic

Construct an Eytzinger search tree from a vector of keys by sorting, deduplicating, and reordering elements into breadth-first layout.

KeyT may differ from T (e.g., creating EytzingerTable<ulittle64_t> from a vector of uint64_t).

Definition at line 139 of file Eytzinger.h.

References EytzingerTable(), llvm::sort(), T, and llvm::unique().

Referenced by llvm::sampleprof::SampleProfileWriterExtBinaryBase::writeMD5ProfileSymbolListSection().

◆ data()

template<typename T>
const T * llvm::EytzingerTable< T >::data ( ) const
inlinenodiscard

Definition at line 177 of file Eytzinger.h.

References T.

◆ empty()

template<typename T>
bool llvm::EytzingerTable< T >::empty ( ) const
inlinenodiscard

Definition at line 179 of file Eytzinger.h.

◆ end() [1/2]

template<typename T>
iterator llvm::EytzingerTable< T >::end ( )
inlinenodiscard

Definition at line 174 of file Eytzinger.h.

◆ end() [2/2]

template<typename T>
const_iterator llvm::EytzingerTable< T >::end ( ) const
inlinenodiscard

Definition at line 175 of file Eytzinger.h.

◆ findIndex()

template<typename T>
template<typename KeyT = T>
std::optional< size_t > llvm::EytzingerTable< T >::findIndex ( const KeyT & Target) const
inlinenodiscard

Definition at line 161 of file Eytzinger.h.

References asSpan().

◆ isSorted()

template<typename T>
bool llvm::EytzingerTable< T >::isSorted ( ) const
inlinenodiscard

Definition at line 170 of file Eytzinger.h.

References asSpan().

◆ operator[]()

template<typename T>
const T & llvm::EytzingerTable< T >::operator[] ( size_t Idx) const
inlinenodiscard

Definition at line 180 of file Eytzinger.h.

References assert(), and T.

◆ size()

template<typename T>
size_t llvm::EytzingerTable< T >::size ( ) const
inlinenodiscard

Definition at line 178 of file Eytzinger.h.


The documentation for this class was generated from the following file: