@@ -38,7 +38,8 @@ def __init__(self, unordered_maps_and_sets):
3838 def normalize (self , type_str ):
3939 return type_str .replace (' ' , '' )
4040
41- def replace_basic_string (self , cls_name ):
41+ @staticmethod
42+ def replace_basic_string (cls_name ):
4243 strings = {
4344 "std::string" : string_equivalences ,
4445 "std::wstring" : wstring_equivalences
@@ -48,7 +49,6 @@ def replace_basic_string(self, cls_name):
4849 for short_name , long_names in strings .items ():
4950 for lname in long_names :
5051 new_name = new_name .replace (lname , short_name )
51-
5252 return new_name
5353
5454 def decorated_call_prefix (self , cls_name , text , doit ):
@@ -99,7 +99,6 @@ def erase_recursive(self, cls_name):
9999 return self .no_end_const (cls_name )
100100
101101 def erase_allocator (self , cls_name , default_allocator = 'std::allocator' ):
102- cls_name = self .replace_basic_string (cls_name )
103102 c_name , c_args = templates .split (cls_name )
104103 if len (c_args ) != 2 :
105104 return
@@ -116,8 +115,8 @@ def erase_allocator(self, cls_name, default_allocator='std::allocator'):
116115 c_name , [self .erase_recursive (value_type )])
117116
118117 def erase_container (self , cls_name , default_container_name = 'std::deque' ):
119- cls_name = self .replace_basic_string (cls_name )
120118 c_name , c_args = templates .split (cls_name )
119+ print ("erase_container" , cls_name , c_name )
121120 if len (c_args ) != 2 :
122121 return
123122 value_type = c_args [0 ]
@@ -132,7 +131,6 @@ def erase_container_compare(
132131 cls_name ,
133132 default_container_name = 'std::vector' ,
134133 default_compare = 'std::less' ):
135- cls_name = self .replace_basic_string (cls_name )
136134 c_name , c_args = templates .split (cls_name )
137135 if len (c_args ) != 3 :
138136 return
@@ -152,7 +150,6 @@ def erase_compare_allocator(
152150 cls_name ,
153151 default_compare = 'std::less' ,
154152 default_allocator = 'std::allocator' ):
155- cls_name = self .replace_basic_string (cls_name )
156153 c_name , c_args = templates .split (cls_name )
157154 if len (c_args ) != 3 :
158155 return
@@ -175,7 +172,6 @@ def erase_map_compare_allocator(
175172 cls_name ,
176173 default_compare = 'std::less' ,
177174 default_allocator = 'std::allocator' ):
178- cls_name = self .replace_basic_string (cls_name )
179175 c_name , c_args = templates .split (cls_name )
180176 if len (c_args ) != 4 :
181177 return
@@ -205,7 +201,6 @@ def erase_map_compare_allocator(
205201 self .erase_recursive (mapped_type )])
206202
207203 def erase_hash_allocator (self , cls_name ):
208- cls_name = self .replace_basic_string (cls_name )
209204 c_name , c_args = templates .split (cls_name )
210205 if len (c_args ) < 3 :
211206 return
@@ -243,7 +238,6 @@ def erase_hash_allocator(self, cls_name):
243238 c_name , [self .erase_recursive (value_type )])
244239
245240 def erase_hashmap_compare_allocator (self , cls_name ):
246- cls_name = self .replace_basic_string (cls_name )
247241 c_name , c_args = templates .split (cls_name )
248242
249243 if self .unordered_maps_and_sets :
@@ -523,6 +517,7 @@ def remove_defaults(self, type_or_string):
523517 name = type_or_string
524518 if not isinstance (type_or_string , str ):
525519 name = self .class_declaration (type_or_string ).name
520+ name = defaults_eraser .replace_basic_string (name )
526521 if not self .remove_defaults_impl :
527522 return name
528523 no_defaults = self .remove_defaults_impl (name )
0 commit comments