@@ -48,12 +48,12 @@ PinyinPrediction::predict(const State &state,
4848
4949 if (lastEncodedPinyin.empty () || sentence.empty ()) {
5050 auto result = Prediction::predictWithScore (state, sentence, maxSize);
51- std::transform (result. begin (), result. end ( ),
52- std::back_inserter (finalResult),
53- [](std::pair<std::string, float > &value) {
54- return std::make_pair ( std::move (value.first ),
55- PinyinPredictionSource::Model);
56- });
51+ std::ranges:: transform (result, std::back_inserter (finalResult ),
52+ []( std::pair<std::string, float > &value) {
53+ return std::make_pair (
54+ std::move (value.first ),
55+ PinyinPredictionSource::Model);
56+ });
5757 return finalResult;
5858 }
5959
@@ -119,11 +119,9 @@ PinyinPrediction::predict(const State &state,
119119
120120 dup.insert (std::get<std::string>(newItem));
121121 intermedidateResult.push_back (std::move (newItem));
122- std::push_heap (intermedidateResult.begin (),
123- intermedidateResult.end (), cmp);
122+ std::ranges::push_heap (intermedidateResult, cmp);
124123 while (intermedidateResult.size () > maxSize) {
125- std::pop_heap (intermedidateResult.begin (),
126- intermedidateResult.end (), cmp);
124+ std::ranges::pop_heap (intermedidateResult, cmp);
127125 dup.erase (
128126 std::get<std::string>(intermedidateResult.back ()));
129127 intermedidateResult.pop_back ();
0 commit comments