@@ -29,7 +29,7 @@ def normalize(self, type_str):
2929 return type_str .replace (' ' , '' )
3030
3131 def replace_basic_string (self , cls_name ):
32-
32+ print ( "replace_basic_string" , cls_name )
3333 # Take the lists of all possible string variations
3434 # and clean them up by replacing ::std by std.
3535 str_eq = [
@@ -102,7 +102,7 @@ def erase_allocator(self, cls_name, default_allocator='std::allocator'):
102102 cls_name = self .replace_basic_string (cls_name )
103103 c_name , c_args = templates .split (cls_name )
104104 if len (c_args ) != 2 :
105- return
105+ return cls_name + "x"
106106 value_type = c_args [0 ]
107107 tmpl = string .Template (
108108 "$container< $value_type, $allocator<$value_type> >" )
@@ -119,12 +119,12 @@ def erase_container(self, cls_name, default_container_name='std::deque'):
119119 cls_name = self .replace_basic_string (cls_name )
120120 c_name , c_args = templates .split (cls_name )
121121 if len (c_args ) != 2 :
122- return
122+ return cls_name
123123 value_type = c_args [0 ]
124124 dc_no_defaults = self .erase_recursive (c_args [1 ])
125125 if self .normalize (dc_no_defaults ) != self .normalize (
126126 templates .join (default_container_name , [value_type ])):
127- return
127+ return cls_name
128128 return templates .join (
129129 c_name , [self .erase_recursive (value_type )])
130130
@@ -136,7 +136,7 @@ def erase_container_compare(
136136 cls_name = self .replace_basic_string (cls_name )
137137 c_name , c_args = templates .split (cls_name )
138138 if len (c_args ) != 3 :
139- return
139+ return cls_name
140140 dc_no_defaults = self .erase_recursive (c_args [1 ])
141141 if self .normalize (dc_no_defaults ) != self .normalize (
142142 templates .join (default_container_name , [c_args [0 ]])):
@@ -156,7 +156,7 @@ def erase_compare_allocator(
156156 cls_name = self .replace_basic_string (cls_name )
157157 c_name , c_args = templates .split (cls_name )
158158 if len (c_args ) != 3 :
159- return
159+ return cls_name
160160 value_type = c_args [0 ]
161161 tmpl = string .Template (
162162 "$container< $value_type, $compare<$value_type>, " +
@@ -179,7 +179,7 @@ def erase_map_compare_allocator(
179179 cls_name = self .replace_basic_string (cls_name )
180180 c_name , c_args = templates .split (cls_name )
181181 if len (c_args ) != 4 :
182- return
182+ return cls_name
183183 key_type = c_args [0 ]
184184 mapped_type = c_args [1 ]
185185 tmpls = [
@@ -209,7 +209,7 @@ def erase_hash_allocator(self, cls_name):
209209 cls_name = self .replace_basic_string (cls_name )
210210 c_name , c_args = templates .split (cls_name )
211211 if len (c_args ) < 3 :
212- return
212+ return cls_name
213213
214214 default_less = 'std::less'
215215 default_equal_to = 'std::equal_to'
@@ -226,7 +226,7 @@ def erase_hash_allocator(self, cls_name):
226226 "$container< $value_type, $hash<$value_type >, " +
227227 "$equal_to<$value_type >, $allocator<$value_type> >" )
228228 else :
229- return
229+ return cls_name
230230
231231 value_type = c_args [0 ]
232232 template = string .Template (tmpl )
@@ -258,7 +258,7 @@ def erase_hashmap_compare_allocator(self, cls_name):
258258 key_type = c_args [0 ]
259259 mapped_type = c_args [1 ]
260260 else :
261- return
261+ return cls_name
262262
263263 if len (c_args ) == 4 :
264264 default_hash = 'hash_compare'
@@ -305,7 +305,7 @@ def erase_hashmap_compare_allocator(self, cls_name):
305305 "$equal_to<$key_type>, " +
306306 "$allocator< $mapped_type > >" )
307307 else :
308- return
308+ return cls_name
309309
310310 for ns in std_namespaces :
311311 inst = tmpl .substitute (
@@ -520,14 +520,13 @@ def remove_defaults(self, type_or_string):
520520 std::vector< int >
521521
522522 """
523-
524523 name = type_or_string
525524 if not isinstance (type_or_string , str ):
526525 name = self .class_declaration (type_or_string ).name
527526 if not self .remove_defaults_impl :
528527 return name
529528 no_defaults = self .remove_defaults_impl (name )
530- if not no_defaults :
529+ if no_defaults is None :
531530 return name
532531 return no_defaults
533532
0 commit comments