20 template<
typename Cont>
26 std::optional<V> Value_;
28 QHash<QString, StringPathTrie> Children_;
37 const auto pos = Children_.find (view);
38 if (pos == Children_.end ())
44 template<StringViewContainer Cont>
45 void Add (Cont&& path, V value)
47 Add (path.begin (), path.end (), std::move (value));
50 template<
typename It,
typename End>
51 void Add (It begin, End end, V value)
55 Value_ = std::move (value);
59 auto pos = Children_.find (*begin);
60 if (pos == Children_.end ())
61 pos = Children_.insert ((*begin).toString (), {});
62 pos->Add (std::next (begin), end, std::move (value));
79 FindResult
Find (QStringView single)
const
81 std::initializer_list<QStringView> dummy { single };
82 return Find (dummy.begin (), dummy.end ());
85 template<StringViewContainer Cont>
86 FindResult
Find (Cont&& path)
const
88 return Find (path.begin (), path.end ());
91 template<
typename It,
typename End>
92 FindResult
Find (It begin, End end)
const
94 return Find (begin, end, { Value_, end - begin,
this });
97 template<
typename It,
typename End>
101 lastGood = { Value_, end - begin,
this };
106 const auto pos = Children_.find (*begin);
107 if (pos == Children_.end ())
110 return pos->Find (std::next (begin), end, lastGood);
void Add(It begin, End end, V value)
const std::optional< V > & GetValue() const
void Add(Cont &&path, V value)
FindResult Find(Cont &&path) const
const StringPathTrie * GetChild(QStringView view) const
FindResult Find(QStringView single) const
FindResult Find(It begin, End end) const
typename detail::Find< Name, Def, Args... >::type Find
IntTrie::FindResult FindResult
bool operator==(const FindResult &other) const
static const StringPathTrie NullTrie
std::optional< V > Value_
const StringPathTrie * Rest_
std::ptrdiff_t Remaining_