Skip to content

Commit 61149b9

Browse files
committed
Revert "Stop masking integer template arguments"
This reverts commit 8128247.
1 parent e581b88 commit 61149b9

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎cpp2rust/converter/mapper.cpp‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <cstdlib>
1414
#include <format>
1515
#include <optional>
16+
#include <regex>
1617
#include <unordered_map>
1718
#include <utility>
1819
#include <vector>
@@ -622,6 +623,17 @@ std::string normalizeTranslationRule(std::string rule) {
622623
// Detach pointer from double reference. Useful for matching translation
623624
// rules.
624625
ReplaceAll(rule, "*&&", "* &&");
626+
627+
static const std::array<std::pair<std::regex, std::string>, 1>
628+
normalization_rules{{
629+
// Ignore constant template parameters, i.e. replace them with _.
630+
{std::regex(R"(\b\d+\b)"), "_"},
631+
}};
632+
633+
for (const auto &r : normalization_rules) {
634+
rule = std::regex_replace(rule, r.first, r.second);
635+
}
636+
625637
return rule;
626638
}
627639

0 commit comments

Comments
 (0)