File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ Regex::Regex(const std::string& re_str) : re_str_(re_str) {
6
6
compiled_pattern_ = new RE2 (re_str_);
7
7
}
8
8
9
+ Regex::~Regex () {
10
+ delete compiled_pattern_;
11
+ }
12
+
9
13
std::string Regex::Sub (std::string str, const std::string& repl) const {
10
14
RE2::GlobalReplace (&str, *compiled_pattern_, repl);
11
15
return str;
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ struct Regex : torch::CustomClassHolder {
13
13
std::string re_str_;
14
14
15
15
TORCHTEXT_API Regex (const std::string& re_str);
16
+ TORCHTEXT_API ~Regex ();
16
17
TORCHTEXT_API std::string Sub (std::string str, const std::string& repl) const ;
17
18
TORCHTEXT_API bool FindAndConsume (re2::StringPiece* input, std::string* text)
18
19
const ;
You can’t perform that action at this time.
0 commit comments