Wordsearch Solver
Namespaces | Classes | Typedefs | Functions
compact_trie2 Namespace Reference

namespace compact_trie2 More...

Classes

class  CompactTrie2
 Variable sized inline contiguous trie to allow 1 byte sized only end of word nodes and full nodes. More...
 
class  EmptyNodeView_
 An empty node is simply a single std::uint8_t (byte) with value 0. More...
 
class  FullNodeView_
 Class representing a full node, a view into a contiguous array. More...
 
class  MiniOffsets
 2 byte wide view onto the offsets of child nodes, relative to the CompactTrie2::next_row_offset(). More...
 

Typedefs

template<class Iterator >
using NodeVariant = std::variant< EmptyNodeView_< Iterator >, FullNodeView_< Iterator > >
 
using DataContainer = std::vector< std::uint8_t >
 
using DataIterator = DataContainer::const_iterator
 
using DataIteratorMut = DataContainer::iterator
 
using RowContainer = std::vector< DataIteratorMut >
 
using RowIterator = RowContainer::const_iterator
 
using RowIteratorMut = RowContainer::iterator
 
using EmptyNodeViewMut = EmptyNodeView_< DataIteratorMut >
 
using EmptyNodeView = EmptyNodeView_< DataIterator >
 
using FullNodeViewMut = FullNodeView_< DataIteratorMut >
 
using FullNodeView = FullNodeView_< DataIterator >
 

Functions

template<class Iterator >
NodeVariant< Iterator > make_node_view_variant (Iterator it)
 
template<class Iterator >
auto node_size (Iterator it)
 
template<class Iterator >
auto node_data_size (Iterator it)
 
template<class Iterator >
bool node_is_end_of_word (Iterator it)
 
template<class Iterator >
std::string node_to_string (Iterator it)
 
template<class OutputIterator , class ForwardCharsRange >
void make_node (const ForwardCharsRange &suffixes, const bool is_end_of_word, OutputIterator out)
 Builds a node from a range of letters/suffixes. More...
 
template<class DataView , class RowIndexes >
auto make_adjacent_pairwise_rows_view (const DataView &data_view, const RowIndexes &row_indexes)
 Used in construction, returns a view onto pairs of {row n, row n + 1}.
 
template<class T >
constexpr bool is_sortable (T &&)
 
template<class T >
constexpr auto sort_if_possible_impl (T &&t, int) -> decltype(ranges::sort(t), void())
 
template<class T >
constexpr void sort_if_possible_impl (T &&, long)
 
template<class T >
constexpr void sort_if_possible (T &&t)
 Sort if possible, but won't be a compilation error if not, then do nothing. More...
 
template<class Rng >
MiniOffsets< Rng > make_mini_offsets (Rng &&rng)
 
std::ostream & operator<< (std::ostream &os, const CompactTrie2 &ct)
 

Detailed Description

namespace compact_trie2

Function Documentation

◆ make_node()

template<class OutputIterator , class ForwardCharsRange >
void compact_trie2::make_node ( const ForwardCharsRange &  suffixes,
const bool  is_end_of_word,
OutputIterator  out 
)

Builds a node from a range of letters/suffixes.

Parameters
[in]suffixesThe letters to insert into this node
[in]is_end_of_wordWhether or not a word terminates here
[out]outThe output iterator that the node is written out to

◆ sort_if_possible()

template<class T >
constexpr void compact_trie2::sort_if_possible ( T &&  t)
constexpr

Sort if possible, but won't be a compilation error if not, then do nothing.

Parameters
[in]tSort t if it may be sorted (ie. it's not const, it's a mutable container not a view)