1 #ifndef DICTIONARY_STD_SET_HPP
2 #define DICTIONARY_STD_SET_HPP
6 #include <initializer_list>
10 #include <string_view>
40 class Iterator1,
class Iterator2,
42 std::is_same_v<typename std::iterator_traits<Iterator1>::value_type,
49 class Iterator1,
class Iterator2,
51 !std::is_same_v<typename std::iterator_traits<Iterator1>::value_type,
58 template <
class ForwardRange>
61 std::size_t size()
const;
65 template <
class OutputIndexIterator>
67 const std::string_view suffixes,
68 OutputIndexIterator contains_further_it)
const;
71 bool contains(
const std::string_view word)
const;
73 bool further(
const std::string_view word)
const;
78 using Iterator = std::set<std::string>::const_iterator;
84 std::set<std::string, std::less<void>>
dict_;
89 #include "wordsearch_solver/dictionary_std_set/dictionary_std_set.tpp"
Naive implementation that stores the dictionary in a std::set.
Definition: dictionary_std_set.hpp:20
bool contains(const std::string_view word) const
Check if this dictionary contains word.
Definition: dictionary_std_set.cpp:39
void contains_further(const std::string_view stem, const std::string_view suffixes, OutputIndexIterator contains_further_it) const
For each char in suffix appended to stem, check whether this dictionary contains this word and if it ...
Definition: dictionary_std_set.tpp:46
DictionaryStdSet(Iterator1 first, const Iterator2 last)
Constructor that does the work.
std::set< std::string, std::less< void > > dict_
Definition: dictionary_std_set.hpp:84
bool further(const std::string_view word) const
Check if this dictionary might contain words with word as a prefix.
Definition: dictionary_std_set.cpp:44
namespace dictionary_std_set
Definition: dictionary_std_set.hpp:13