MCPcopy Create free account
hub / github.com/dmlc/xgboost / MakeStrArrayImpl

Function MakeStrArrayImpl

tests/cpp/encoder/df_mock.h:20–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18namespace enc {
19template <typename... Strs>
20auto MakeStrArrayImpl(Strs&&... strs) {
21 std::vector<std::string> names{strs...};
22 std::vector<std::int8_t> values;
23 std::vector<std::int32_t> offsets{0};
24
25 for (const auto& name : names) {
26 for (char c : name) {
27 values.push_back(c);
28 }
29 offsets.push_back(name.size());
30 }
31 std::partial_sum(offsets.cbegin(), offsets.cend(), offsets.begin());
32 return xgboost::cpu_impl::CatStrArray{offsets, values};
33}
34} // namespace enc
35
36namespace enc::cpu_impl {

Callers 1

MakeStrsMethod · 0.85

Calls 4

sizeMethod · 0.45
cbeginMethod · 0.45
cendMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected