MCPcopy Create free account
hub / github.com/catboost/catboost / LexicographicStep

Function LexicographicStep

library/cpp/containers/comptrie/comptrie_ut.cpp:324–338  ·  view source on GitHub ↗

Iterates over all strings of length <= 4 made of letters a-g.

Source from the content-addressed store, hash-verified

322
323// Iterates over all strings of length <= 4 made of letters a-g.
324static bool LexicographicStep(TString& s) {
325 if (s.length() < 4) {
326 s += "a";
327 return true;
328 }
329 while (!s.empty() && s.back() == 'g')
330 s.pop_back();
331 if (s.empty())
332 return false;
333 char last = s.back();
334 last++;
335 s.pop_back();
336 s.push_back(last);
337 return true;
338}
339
340template <class T>
341void TCompactTrieTest::CheckUpperBound(const char* data, size_t datalen) {

Callers 1

CheckUpperBoundMethod · 0.85

Calls 5

lengthMethod · 0.45
emptyMethod · 0.45
backMethod · 0.45
pop_backMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected