62#ifndef __ADS_BitmapTrie
63 #define __ADS_BitmapTrie
98template<
class V = std::monostate >
145 [[nodiscard]]
const std::string *
lowerBound( std::string_view s )
const;
148 [[nodiscard]]
const std::string *
find( std::string_view s )
const;
151 [[nodiscard]] std::optional< V >
lookup( std::string_view s )
const;
154 [[nodiscard]]
bool contains( std::string_view s )
const;
180 bool insert( std::string_view s ,
const V & v = V() );
206 [[nodiscard]] std::size_t
size(
void )
const {
return( f_n ); }
209 [[nodiscard]]
bool empty(
void )
const {
return( f_n == 0 ); }
212 [[nodiscard]] std::size_t
nodes(
void )
const {
return( f_nodes ); }
223 Cell * prev =
nullptr;
224 Cell * next =
nullptr;
231 std::array< std::uint64_t , 4 > bits{};
232 std::vector< Node * > kids;
233 Cell * term =
nullptr;
234 Cell * min =
nullptr;
235 Cell * max =
nullptr;
271 return(
reference( f_l->key , f_l->value ) );
304 const Cell * f_l =
nullptr;
339 [[nodiscard]]
static bool has(
const Node * u ,
unsigned c );
342 [[nodiscard]]
static std::size_t rank(
const Node * u ,
unsigned c );
345 [[nodiscard]]
static Node * child(
const Node * u ,
unsigned c );
348 [[nodiscard]]
static Node * after(
const Node * u ,
unsigned c );
351 [[nodiscard]]
static bool before(
const Node * u ,
unsigned c );
354 [[nodiscard]] Node * node( std::string_view s )
const;
357 [[nodiscard]] Cell * successor( std::string_view s )
const;
360 static void destroy( Node * u );
363 [[nodiscard]]
bool consistent(
void )
const;
367 [[nodiscard]]
bool subtree(
const Node * u ,
const Cell *& lo ,
368 const Cell *& hi , std::size_t & n )
const;
373 std::size_t f_nodes = 1;
385#include "ADS/dictionary/impl/BitmapTrie.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The iterators that the containers of the library have in common, beyond the book: they give a contain...
the bidirectional iterator along the list
Definition BitmapTrie.h:246
V mapped_type
the type of the values
Definition BitmapTrie.h:255
const_iterator(void)=default
the end of no trie
std::bidirectional_iterator_tag iterator_category
the category of the iterator
Definition BitmapTrie.h:249
const_iterator & operator++(void)
to the next string
Definition BitmapTrie.h:275
PairRef< const std::string &, const V & > reference
a pair of references, by value
Definition BitmapTrie.h:259
bool operator==(const const_iterator &o) const =default
equal on the same item
void pointer
no pointer: the pairs are made on the fly
Definition BitmapTrie.h:261
reference operator*(void) const
the pair of the item
Definition BitmapTrie.h:270
const_iterator & operator--(void)
to the previous string
Definition BitmapTrie.h:288
const_iterator operator--(int)
to the previous string, returning the iterator before the step
Definition BitmapTrie.h:294
const_iterator(const Cell *l)
on the item
Definition BitmapTrie.h:267
std::string key_type
the type of the keys
Definition BitmapTrie.h:253
std::pair< std::string, V > value_type
the pairs ( key , value ) by value, which own their copies
Definition BitmapTrie.h:251
const_iterator operator++(int)
to the next string, returning the iterator before the step
Definition BitmapTrie.h:281
std::ptrdiff_t difference_type
the type of the distances between two iterators
Definition BitmapTrie.h:257
bool insert(std::string_view s, const V &v=V())
associates to ; true if was not there, in time
std::string Item
the items of the SSet, the strings
Definition BitmapTrie.h:105
std::optional< V > lookup(std::string_view s) const
the value of , or nothing, in time
BitmapTrie(BitmapTrie &&o)
the trie of o, which is left empty
const_iterator cend(void) const
as end()
Definition BitmapTrie.h:331
bool contains(std::string_view s) const
true if is there, in time
reference const_reference
a pair of references, by value
Definition BitmapTrie.h:316
const_iterator iterator
the iterator on the items
Definition BitmapTrie.h:318
const std::string * find(std::string_view s) const
the string , nil if it is not there, in time
const_iterator seek(std::string_view s) const
the iterator on the smallest string , end() if none
std::ptrdiff_t difference_type
the type of the distances between two iterators
Definition BitmapTrie.h:312
BitmapTrie(void)
the empty trie
BitmapTrie(const BitmapTrie &)=delete
std::size_t size_type
the type of the sizes
Definition BitmapTrie.h:310
std::string Key
the type of the keys
Definition BitmapTrie.h:104
bool remove(std::string_view s)
removes ; true if it was there, in time
V Value
the type of the values
Definition BitmapTrie.h:106
BitmapTrie & operator=(BitmapTrie &&o) noexcept
the trie of o, which gets the strings of this one
~BitmapTrie()
frees the nodes and the strings
std::size_t nodes(void) const
the number of nodes, the root included
Definition BitmapTrie.h:212
const_iterator end(void) const
the iterator past the largest string
Definition BitmapTrie.h:325
bool empty(void) const
true if there are no strings
Definition BitmapTrie.h:209
std::size_t size(void) const
the number of strings
Definition BitmapTrie.h:206
BitmapTrie & operator=(const BitmapTrie &)=delete
typename const_iterator::value_type value_type
the type of the items, for the standard library
Definition BitmapTrie.h:308
const_iterator begin(void) const
the iterator on the smallest string
Definition BitmapTrie.h:321
const_iterator cbegin(void) const
as begin()
Definition BitmapTrie.h:329
const std::string * lowerBound(std::string_view s) const
the smallest string , nil if none (the find( s ) of the SSet of Morin's book), in time
typename const_iterator::reference reference
a pair of references, by value
Definition BitmapTrie.h:314
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