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

Function FormatKeyValueRange

library/cpp/yt/string/format-inl.h:221–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219
220template <class TRange, class TFormatter>
221void FormatKeyValueRange(TStringBuilderBase* builder, const TRange& range, const TFormatter& formatter, size_t limit = std::numeric_limits<size_t>::max())
222{
223 builder->AppendChar('{');
224 size_t index = 0;
225 for (const auto& item : range) {
226 if (index > 0) {
227 builder->AppendString(DefaultJoinToStringDelimiter);
228 }
229 if (index == limit) {
230 builder->AppendString(DefaultRangeEllipsisFormat);
231 break;
232 }
233 formatter(builder, item.first);
234 builder->AppendString(DefaultKeyValueDelimiter);
235 formatter(builder, item.second);
236 ++index;
237 }
238 builder->AppendChar('}');
239}
240
241////////////////////////////////////////////////////////////////////////////////
242

Callers 1

FormatValueFunction · 0.85

Calls 4

AppendCharMethod · 0.80
maxFunction · 0.50
formatterFunction · 0.50
AppendStringMethod · 0.45

Tested by

no test coverage detected