84#ifndef __ADS_XFastTrie
85 #define __ADS_XFastTrie
120template< std::unsigned_integral U ,
class V = std::monostate ,
121 int W = std::numeric_limits< U >::digits >
123class XFastTrie :
public detail::JumpTrie< U , V , W , true >
126 using Base = detail::JumpTrie< U , V , W , true >;
166template< std::unsigned_integral U ,
class V = std::monostate ,
167 int W = std::numeric_limits< U >::digits >
223 [[nodiscard]]
const U *
find( U x )
const;
236 [[nodiscard]] std::optional< V >
lookup( U x )
const;
291 [[nodiscard]] std::size_t
size(
void )
const {
return( f_n ); }
294 [[nodiscard]]
bool empty(
void )
const {
return( f_n == 0 ); }
297 [[nodiscard]] std::size_t
entries(
void )
const;
304 Leaf * prev =
nullptr;
305 Leaf * next =
nullptr;
350 return(
reference( f_l->key , f_l->value ) );
383 const Leaf * f_l =
nullptr;
420 [[nodiscard]]
bool entry( U p ,
int i , Entry & e )
const;
424 [[nodiscard]] Leaf * follow( U x ,
const Entry & e ,
int l )
const;
427 [[nodiscard]] Leaf * successor( U x )
const;
431 [[nodiscard]]
int deepest( U x ,
int lo ,
int hi , Entry & e )
const;
435 [[nodiscard]]
bool consistent( U x )
const;
438 Leaf * f_dummy =
nullptr;
440 std::array< FlatHashTable< U , Entry > , W + 1 > f_t;
453#include "ADS/dictionary/impl/XFastTrie.tpp"
The binary tries of the integers of bits, beyond the book: a SORTED SET of keys ,...
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
A hash table with open addressing and control bytes, beyond the book: the engineered DICTIONARY of AD...
The iterators that the containers of the library have in common, beyond the book: they give a contain...
A pool of objects of one type, beyond the book: make() builds an object in a slot of the pool and fre...
the bidirectional iterator along the list
Definition XFastTrie.h:325
std::ptrdiff_t difference_type
the type of the distances between two iterators
Definition XFastTrie.h:336
V mapped_type
the type of the values
Definition XFastTrie.h:334
std::bidirectional_iterator_tag iterator_category
the category of the iterator
Definition XFastTrie.h:328
reference operator*(void) const
the pair of the key
Definition XFastTrie.h:349
void pointer
no pointer: the pairs are made on the fly
Definition XFastTrie.h:340
const_iterator & operator--(void)
to the previous key
Definition XFastTrie.h:367
U key_type
the type of the keys
Definition XFastTrie.h:332
const_iterator(const Leaf *l)
on the key
Definition XFastTrie.h:346
bool operator==(const const_iterator &o) const =default
equal on the same key
const_iterator & operator++(void)
to the next key
Definition XFastTrie.h:354
PairRef< const U &, const V & > reference
a pair of references, by value
Definition XFastTrie.h:338
const_iterator(void)=default
the end of no trie
const_iterator operator++(int)
to the next key, returning the iterator before the step
Definition XFastTrie.h:360
const_iterator operator--(int)
to the previous key, returning the iterator before the step
Definition XFastTrie.h:373
std::pair< U, V > value_type
the pairs ( key , value ) by value, which own their copies
Definition XFastTrie.h:330
ListXFastTrie(void)
the empty trie
const_iterator begin(void) const
the iterator on the smallest key
Definition XFastTrie.h:400
ListXFastTrie & operator=(ListXFastTrie &&o) noexcept
the trie of o, which is left empty; the keys of this one are freed
bool insert(U x, const V &v=V())
associates to ; true if was not there, in expected time
ListXFastTrie(ListXFastTrie &&o)
the trie of o, which is left empty
std::size_t size(void) const
the number of keys
Definition XFastTrie.h:291
typename const_iterator::reference reference
a pair of references, by value
Definition XFastTrie.h:393
std::size_t entries(void) const
the number of entries of the tables
bool empty(void) const
true if there are no keys
Definition XFastTrie.h:294
std::ptrdiff_t difference_type
the type of the distances between two iterators
Definition XFastTrie.h:391
const_iterator seek(U x) const
the iterator on the smallest key , end() if none
U Key
the type of the keys
Definition XFastTrie.h:174
ListXFastTrie & operator=(const ListXFastTrie &)=delete
~ListXFastTrie()
frees the keys
bool contains(U x) const
true if is there, in expected time
const U * find(U x) const
the key , nil if it is not there, in expected time
typename const_iterator::value_type value_type
the type of the items, for the standard library
Definition XFastTrie.h:387
const_iterator end(void) const
the iterator past the largest key
Definition XFastTrie.h:404
const_iterator iterator
the iterator on the items
Definition XFastTrie.h:397
U Item
the items of the SSet, the keys
Definition XFastTrie.h:175
ListXFastTrie(const ListXFastTrie &)=delete
const_iterator cend(void) const
as end()
Definition XFastTrie.h:410
std::optional< V > lookup(U x) const
the value of , or nothing, in expected time
V Value
the type of the values
Definition XFastTrie.h:176
const U * lowerBound(U x) const
the smallest key , nil if none (the find( x ) of the SSet of Morin's book), in expected time
bool remove(U x)
removes ; true if it was there, in expected time
std::size_t size_type
the type of the sizes
Definition XFastTrie.h:389
const_iterator cbegin(void) const
as begin()
Definition XFastTrie.h:408
const U * findNear(U x) const
the smallest key , nil if none, in expected time
reference const_reference
a pair of references, by value
Definition XFastTrie.h:395
the x-fast trie: a binary trie with a hash table of the prefixes per depth
Definition XFastTrie.h:124
const U * findNear(U x) const
the smallest key , nil if none, in expected time
the number of bits of the keys of a trie on U: , if it is between 1 and the bits of U
Definition BinaryTrie.h:103
std::conditional_t< detail::plainPair< A, B, VA, VB >, std::pair< A, B >, detail::PairProxy< A, B, VA, VB > > PairRef
the pair that an iterator reads by value, in general two references into the container,...
Definition Iterators.h:648