20 template<
typename Cont>
26 std::optional<V> Value_;
29 QHash<QString, StringPathTrie> Children_;
38 const auto pos = Children_.find (view.toString ());
39 if (pos == Children_.end ())
45 template<StringViewContainer Cont>
46 void Add (Cont&& path, V value)
48 Add (path.begin (), path.end (), std::move (value));
51 template<
typename It,
typename End>
52 void Add (It begin, End end, V value)
56 Value_ = std::move (value);
60 const auto& strRef = (*begin).toString ();
61 auto pos = Children_.find (strRef);
62 if (pos == Children_.end ())
63 pos = Children_.insert (strRef, {});
64 pos->Add (std::next (begin), end, std::move (value));
81 FindResult
Find (QStringView single)
const
83 std::initializer_list<QStringView> dummy { single };
84 return Find (dummy.begin (), dummy.end ());
87 template<StringViewContainer Cont>
88 FindResult
Find (Cont&& path)
const
90 return Find (path.begin (), path.end ());
93 template<
typename It,
typename End>
94 FindResult
Find (It begin, End end)
const
96 return Find (begin, end, { Value_, end - begin,
this });
99 template<
typename It,
typename End>
103 lastGood = { Value_, end - begin,
this };
108 const auto& strRef = (*begin).toString ();
109 const auto pos = Children_.find (strRef);
110 if (pos == Children_.end ())
113 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_