MCPcopy Create free account
hub / github.com/comaps/comaps / AddAllNonemptySubstrings

Function AddAllNonemptySubstrings

libs/indexer/categories_index.cpp:17–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15namespace
16{
17void AddAllNonemptySubstrings(base::MemTrie<std::string, base::VectorValues<uint32_t>> & trie, std::string const & s,
18 uint32_t value)
19{
20 ASSERT(!s.empty(), ());
21 for (size_t i = 0; i < s.length(); ++i)
22 {
23 std::string t;
24 for (size_t j = i; j < s.length(); ++j)
25 {
26 t.push_back(s[j]);
27 trie.Add(t, value);
28 }
29 }
30}
31
32template <typename TF>
33void ForEachToken(std::string const & s, TF && fn)

Callers 1

Calls 5

ASSERTFunction · 0.85
lengthMethod · 0.80
emptyMethod · 0.45
push_backMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected