11// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
22// SPDX-License-Identifier: MIT
33// RapidFuzz v1.0.2
4- // Generated: 2024-07-02 16:47:26.932914
4+ // Generated: 2024-10-24 12:06:59.588890
55// ----------------------------------------------------------
66// This file is an amalgamation of multiple different files.
77// You probably shouldn't edit it directly.
@@ -4511,8 +4511,8 @@ void lcs_simd(Range<size_t*> scores, const BlockPatternMatchVector& block, const
45114511#endif
45124512
45134513template <size_t N, bool RecordMatrix, typename PMV, typename InputIt1, typename InputIt2>
4514- auto lcs_unroll (const PMV& block, const Range<InputIt1>&, const Range<InputIt2>& s2, size_t score_cutoff = 0 )
4515- -> LCSseqResult<RecordMatrix>
4514+ auto lcs_unroll (const PMV& block, const Range<InputIt1>&, const Range<InputIt2>& s2,
4515+ size_t score_cutoff = 0 ) -> LCSseqResult<RecordMatrix>
45164516{
45174517 uint64_t S[N];
45184518 unroll<size_t , N>([&](size_t i) { S[i] = ~UINT64_C (0 ); });
@@ -6662,12 +6662,12 @@ struct CachedJaroWinkler : public detail::CachedSimilarityBase<CachedJaroWinkler
66626662};
66636663
66646664template <typename Sentence1>
6665- explicit CachedJaroWinkler (const Sentence1& s1_, double _prefix_weight = 0.1 )
6666- -> CachedJaroWinkler<char_type<Sentence1>>;
6665+ explicit CachedJaroWinkler (const Sentence1& s1_,
6666+ double _prefix_weight = 0.1 ) -> CachedJaroWinkler<char_type<Sentence1>>;
66676667
66686668template <typename InputIt1>
6669- CachedJaroWinkler (InputIt1 first1, InputIt1 last1, double _prefix_weight = 0.1 )
6670- -> CachedJaroWinkler<iter_value_t <InputIt1>>;
6669+ CachedJaroWinkler (InputIt1 first1, InputIt1 last1,
6670+ double _prefix_weight = 0.1 ) -> CachedJaroWinkler<iter_value_t <InputIt1>>;
66716671
66726672} // namespace rapidfuzz
66736673
@@ -7135,8 +7135,8 @@ size_t levenshtein_hyrroe2003_small_band(const BlockPatternMatchVector& PM, cons
71357135}
71367136
71377137template <bool RecordMatrix, typename InputIt1, typename InputIt2>
7138- auto levenshtein_hyrroe2003_small_band (const Range<InputIt1>& s1, const Range<InputIt2>& s2, size_t max)
7139- -> LevenshteinResult<RecordMatrix, false>
7138+ auto levenshtein_hyrroe2003_small_band (const Range<InputIt1>& s1, const Range<InputIt2>& s2,
7139+ size_t max) -> LevenshteinResult<RecordMatrix, false>
71407140{
71417141 assert (max <= s1.size ());
71427142 assert (max <= s2.size ());
@@ -8358,12 +8358,12 @@ struct CachedLevenshtein : public detail::CachedDistanceBase<CachedLevenshtein<C
83588358};
83598359
83608360template <typename Sentence1>
8361- explicit CachedLevenshtein (const Sentence1& s1_, LevenshteinWeightTable aWeights = {1 , 1 , 1 })
8362- -> CachedLevenshtein<char_type<Sentence1>>;
8361+ explicit CachedLevenshtein (const Sentence1& s1_, LevenshteinWeightTable aWeights = {
8362+ 1 , 1 , 1 }) -> CachedLevenshtein<char_type<Sentence1>>;
83638363
83648364template <typename InputIt1>
8365- CachedLevenshtein (InputIt1 first1, InputIt1 last1, LevenshteinWeightTable aWeights = { 1 , 1 , 1 })
8366- -> CachedLevenshtein<iter_value_t<InputIt1>>;
8365+ CachedLevenshtein (InputIt1 first1, InputIt1 last1,
8366+ LevenshteinWeightTable aWeights = { 1 , 1 , 1 }) -> CachedLevenshtein<iter_value_t<InputIt1>>;
83678367
83688368} // namespace rapidfuzz
83698369
@@ -9151,35 +9151,39 @@ CachedPrefix(InputIt1 first1, InputIt1 last1) -> CachedPrefix<iter_value_t<Input
91519151
91529152namespace rapidfuzz {
91539153
9154- template <typename CharT, typename InputIt1, typename InputIt2>
9155- std::basic_string<CharT> editops_apply (const Editops& ops, InputIt1 first1, InputIt1 last1, InputIt2 first2,
9156- InputIt2 last2)
9154+ namespace detail {
9155+ template <typename ReturnType, typename InputIt1, typename InputIt2>
9156+ ReturnType editops_apply_impl (const Editops& ops, InputIt1 first1, InputIt1 last1, InputIt2 first2,
9157+ InputIt2 last2)
91579158{
91589159 auto len1 = static_cast <size_t >(std::distance (first1, last1));
91599160 auto len2 = static_cast <size_t >(std::distance (first2, last2));
91609161
9161- std::basic_string<CharT> res_str;
9162+ ReturnType res_str;
91629163 res_str.resize (len1 + len2);
91639164 size_t src_pos = 0 ;
91649165 size_t dest_pos = 0 ;
91659166
91669167 for (const auto & op : ops) {
91679168 /* matches between last and current editop */
91689169 while (src_pos < op.src_pos ) {
9169- res_str[dest_pos] = static_cast <CharT>(first1[static_cast <ptrdiff_t >(src_pos)]);
9170+ res_str[dest_pos] =
9171+ static_cast <typename ReturnType::value_type>(first1[static_cast <ptrdiff_t >(src_pos)]);
91709172 src_pos++;
91719173 dest_pos++;
91729174 }
91739175
91749176 switch (op.type ) {
91759177 case EditType::None:
91769178 case EditType::Replace:
9177- res_str[dest_pos] = static_cast <CharT>(first2[static_cast <ptrdiff_t >(op.dest_pos )]);
9179+ res_str[dest_pos] =
9180+ static_cast <typename ReturnType::value_type>(first2[static_cast <ptrdiff_t >(op.dest_pos )]);
91789181 src_pos++;
91799182 dest_pos++;
91809183 break ;
91819184 case EditType::Insert:
9182- res_str[dest_pos] = static_cast <CharT>(first2[static_cast <ptrdiff_t >(op.dest_pos )]);
9185+ res_str[dest_pos] =
9186+ static_cast <typename ReturnType::value_type>(first2[static_cast <ptrdiff_t >(op.dest_pos )]);
91839187 dest_pos++;
91849188 break ;
91859189 case EditType::Delete: src_pos++; break ;
@@ -9188,7 +9192,8 @@ std::basic_string<CharT> editops_apply(const Editops& ops, InputIt1 first1, Inpu
91889192
91899193 /* matches after the last editop */
91909194 while (src_pos < len1) {
9191- res_str[dest_pos] = static_cast <CharT>(first1[static_cast <ptrdiff_t >(src_pos)]);
9195+ res_str[dest_pos] =
9196+ static_cast <typename ReturnType::value_type>(first1[static_cast <ptrdiff_t >(src_pos)]);
91929197 src_pos++;
91939198 dest_pos++;
91949199 }
@@ -9197,35 +9202,30 @@ std::basic_string<CharT> editops_apply(const Editops& ops, InputIt1 first1, Inpu
91979202 return res_str;
91989203}
91999204
9200- template <typename CharT, typename Sentence1, typename Sentence2>
9201- std::basic_string<CharT> editops_apply (const Editops& ops, const Sentence1& s1, const Sentence2& s2)
9202- {
9203- return editops_apply<CharT>(ops, detail::to_begin (s1), detail::to_end (s1), detail::to_begin (s2),
9204- detail::to_end (s2));
9205- }
9206-
9207- template <typename CharT, typename InputIt1, typename InputIt2>
9208- std::basic_string<CharT> opcodes_apply (const Opcodes& ops, InputIt1 first1, InputIt1 last1, InputIt2 first2,
9209- InputIt2 last2)
9205+ template <typename ReturnType, typename InputIt1, typename InputIt2>
9206+ ReturnType opcodes_apply_impl (const Opcodes& ops, InputIt1 first1, InputIt1 last1, InputIt2 first2,
9207+ InputIt2 last2)
92109208{
92119209 auto len1 = static_cast <size_t >(std::distance (first1, last1));
92129210 auto len2 = static_cast <size_t >(std::distance (first2, last2));
92139211
9214- std::basic_string<CharT> res_str;
9212+ ReturnType res_str;
92159213 res_str.resize (len1 + len2);
92169214 size_t dest_pos = 0 ;
92179215
92189216 for (const auto & op : ops) {
92199217 switch (op.type ) {
92209218 case EditType::None:
92219219 for (auto i = op.src_begin ; i < op.src_end ; ++i) {
9222- res_str[dest_pos++] = static_cast <CharT>(first1[static_cast <ptrdiff_t >(i)]);
9220+ res_str[dest_pos++] =
9221+ static_cast <typename ReturnType::value_type>(first1[static_cast <ptrdiff_t >(i)]);
92239222 }
92249223 break ;
92259224 case EditType::Replace:
92269225 case EditType::Insert:
92279226 for (auto i = op.dest_begin ; i < op.dest_end ; ++i) {
9228- res_str[dest_pos++] = static_cast <CharT>(first2[static_cast <ptrdiff_t >(i)]);
9227+ res_str[dest_pos++] =
9228+ static_cast <typename ReturnType::value_type>(first2[static_cast <ptrdiff_t >(i)]);
92299229 }
92309230 break ;
92319231 case EditType::Delete: break ;
@@ -9236,11 +9236,62 @@ std::basic_string<CharT> opcodes_apply(const Opcodes& ops, InputIt1 first1, Inpu
92369236 return res_str;
92379237}
92389238
9239+ } // namespace detail
9240+
9241+ template <typename CharT, typename InputIt1, typename InputIt2>
9242+ std::basic_string<CharT> editops_apply_str (const Editops& ops, InputIt1 first1, InputIt1 last1,
9243+ InputIt2 first2, InputIt2 last2)
9244+ {
9245+ return detail::editops_apply_impl<std::basic_string<CharT>>(ops, first1, last1, first2, last2);
9246+ }
9247+
9248+ template <typename CharT, typename Sentence1, typename Sentence2>
9249+ std::basic_string<CharT> editops_apply_str (const Editops& ops, const Sentence1& s1, const Sentence2& s2)
9250+ {
9251+ return detail::editops_apply_impl<std::basic_string<CharT>>(ops, detail::to_begin (s1), detail::to_end (s1),
9252+ detail::to_begin (s2), detail::to_end (s2));
9253+ }
9254+
9255+ template <typename CharT, typename InputIt1, typename InputIt2>
9256+ std::basic_string<CharT> opcodes_apply_str (const Opcodes& ops, InputIt1 first1, InputIt1 last1,
9257+ InputIt2 first2, InputIt2 last2)
9258+ {
9259+ return detail::opcodes_apply_impl<std::basic_string<CharT>>(ops, first1, last1, first2, last2);
9260+ }
9261+
9262+ template <typename CharT, typename Sentence1, typename Sentence2>
9263+ std::basic_string<CharT> opcodes_apply_str (const Opcodes& ops, const Sentence1& s1, const Sentence2& s2)
9264+ {
9265+ return detail::opcodes_apply_impl<std::basic_string<CharT>>(ops, detail::to_begin (s1), detail::to_end (s1),
9266+ detail::to_begin (s2), detail::to_end (s2));
9267+ }
9268+
9269+ template <typename CharT, typename InputIt1, typename InputIt2>
9270+ std::vector<CharT> editops_apply_vec (const Editops& ops, InputIt1 first1, InputIt1 last1, InputIt2 first2,
9271+ InputIt2 last2)
9272+ {
9273+ return detail::editops_apply_impl<std::vector<CharT>>(ops, first1, last1, first2, last2);
9274+ }
9275+
9276+ template <typename CharT, typename Sentence1, typename Sentence2>
9277+ std::vector<CharT> editops_apply_vec (const Editops& ops, const Sentence1& s1, const Sentence2& s2)
9278+ {
9279+ return detail::editops_apply_impl<std::vector<CharT>>(ops, detail::to_begin (s1), detail::to_end (s1),
9280+ detail::to_begin (s2), detail::to_end (s2));
9281+ }
9282+
9283+ template <typename CharT, typename InputIt1, typename InputIt2>
9284+ std::vector<CharT> opcodes_apply_vec (const Opcodes& ops, InputIt1 first1, InputIt1 last1, InputIt2 first2,
9285+ InputIt2 last2)
9286+ {
9287+ return detail::opcodes_apply_impl<std::vector<CharT>>(ops, first1, last1, first2, last2);
9288+ }
9289+
92399290template <typename CharT, typename Sentence1, typename Sentence2>
9240- std::basic_string <CharT> opcodes_apply (const Opcodes& ops, const Sentence1& s1, const Sentence2& s2)
9291+ std::vector <CharT> opcodes_apply_vec (const Opcodes& ops, const Sentence1& s1, const Sentence2& s2)
92419292{
9242- return opcodes_apply< CharT>(ops, detail::to_begin (s1), detail::to_end (s1), detail::to_begin (s2 ),
9243- detail::to_end (s2));
9293+ return detail::opcodes_apply_impl<std::vector< CharT>> (ops, detail::to_begin (s1), detail::to_end (s1),
9294+ detail::to_begin (s2), detail::to_end (s2));
92449295}
92459296
92469297} // namespace rapidfuzz
@@ -9669,8 +9720,8 @@ explicit CachedPartialTokenSortRatio(const Sentence1& s1)
96699720 -> CachedPartialTokenSortRatio<char_type<Sentence1>>;
96709721
96719722template <typename InputIt1>
9672- CachedPartialTokenSortRatio (InputIt1 first1, InputIt1 last1)
9673- -> CachedPartialTokenSortRatio<iter_value_t <InputIt1>>;
9723+ CachedPartialTokenSortRatio (InputIt1 first1,
9724+ InputIt1 last1) -> CachedPartialTokenSortRatio<iter_value_t <InputIt1>>;
96749725
96759726/* *
96769727 * @brief Compares the words in the strings based on unique and common words
@@ -9793,8 +9844,8 @@ template <typename Sentence1>
97939844explicit CachedPartialTokenSetRatio (const Sentence1& s1) -> CachedPartialTokenSetRatio<char_type<Sentence1>>;
97949845
97959846template <typename InputIt1>
9796- CachedPartialTokenSetRatio (InputIt1 first1, InputIt1 last1)
9797- -> CachedPartialTokenSetRatio<iter_value_t <InputIt1>>;
9847+ CachedPartialTokenSetRatio (InputIt1 first1,
9848+ InputIt1 last1) -> CachedPartialTokenSetRatio<iter_value_t <InputIt1>>;
97989849
97999850/* *
98009851 * @brief Helper method that returns the maximum of fuzz::token_set_ratio and
0 commit comments