LLVM 23.0.0git
llvm::EytzingerTableSpan< T > Class Template Reference

Non-owning view of a buffer formatted as a complete binary search tree in Eytzinger (breadth-first) order. More...

#include "llvm/ADT/Eytzinger.h"

Public Member Functions

 EytzingerTableSpan ()=default
 EytzingerTableSpan (const T *Data, size_t NumEntries)
const Tdata () const
bool empty () const
size_t size () const
const Toperator[] (size_t Idx) const
template<typename KeyT = T>
std::optional< size_tfindIndex (const KeyT &Target) const
 Search this Eytzinger table for Target.
template<typename KeyT = T>
bool contains (const KeyT &Target) const
 Check if this Eytzinger table contains Target.
bool isSorted () const
 Verify whether the buffer satisfies strictly ascending binary search tree order in Eytzinger layout.

Detailed Description

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

Non-owning view of a buffer formatted as a complete binary search tree in Eytzinger (breadth-first) order.

Definition at line 27 of file Eytzinger.h.

Constructor & Destructor Documentation

◆ EytzingerTableSpan() [1/2]

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

◆ EytzingerTableSpan() [2/2]

template<typename T>
llvm::EytzingerTableSpan< T >::EytzingerTableSpan ( const T * Data,
size_t NumEntries )
inline

Definition at line 30 of file Eytzinger.h.

References T.

Member Function Documentation

◆ contains()

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

Check if this Eytzinger table contains Target.

Definition at line 60 of file Eytzinger.h.

References findIndex().

◆ data()

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

Definition at line 33 of file Eytzinger.h.

References T.

◆ empty()

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

Definition at line 34 of file Eytzinger.h.

Referenced by isSorted().

◆ findIndex()

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

Search this Eytzinger table for Target.

Returns the 0-based array index if found.

KeyT enables heterogeneous lookups, allowing callers to search tables of endian-specific wrappers (e.g., support::ulittle64_t) using native integer keys without explicit conversions at the call site.

Definition at line 48 of file Eytzinger.h.

References I.

Referenced by contains().

◆ isSorted()

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

Verify whether the buffer satisfies strictly ascending binary search tree order in Eytzinger layout.

Runs iteratively in O(N) time and O(1) space.

Definition at line 66 of file Eytzinger.h.

References empty(), I, llvm::Left, llvm::Right, and T.

◆ operator[]()

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

Definition at line 36 of file Eytzinger.h.

References assert(), and T.

◆ size()

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

Definition at line 35 of file Eytzinger.h.


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