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

Function ToSmthRet

util/charset/wide.cpp:494–512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

492
493template <typename F>
494static TUtf16String ToSmthRet(const TWtringBuf text, size_t pos, size_t count, F&& f) {
495 pos = pos < text.size() ? pos : text.size();
496 count = count < text.size() - pos ? count : text.size() - pos;
497
498 auto res = TUtf16String::Uninitialized(text.size());
499 auto* const resBegin = res.Detach();
500
501 if (pos) {
502 MemCopy(resBegin, text.data(), pos);
503 }
504
505 f(text.data() + pos, count, resBegin + pos);
506
507 if (count - pos != text.size()) {
508 MemCopy(resBegin + pos + count, text.data() + pos + count, text.size() - pos - count);
509 }
510
511 return res;
512}
513
514template <typename F>
515static TUtf32String ToSmthRet(const TUtf32StringBuf text, size_t pos, size_t count, F&& f) {

Callers 3

ToLowerRetFunction · 0.85
ToUpperRetFunction · 0.85
ToTitleRetFunction · 0.85

Calls 6

MemCopyFunction · 0.85
UninitializedFunction · 0.50
fFunction · 0.50
sizeMethod · 0.45
DetachMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected