Skip to content

Commit 08c3309

Browse files
committed
Take into account of tr1 namespace correctly for container traits
1 parent efd0de7 commit 08c3309

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

pygccxml/declarations/container_traits.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,17 @@ def get_container_or_none(self, type_):
411411
"declaration starts with " + self.name() + '<')
412412
return
413413

414+
if type_.declaration.parent.name == "tr1":
415+
# When using libstd++, some container traits are defined in
416+
# std::tr1:: . See remove_template_defaults_tester.py.
417+
# In this case the is_defined_in_xxx test needs to be done
418+
# on the parent
419+
decl = cls_declaration.parent
420+
else:
421+
decl = cls_declaration
422+
414423
for ns in std_namespaces:
415-
if type_traits.impl_details.is_defined_in_xxx(ns, cls_declaration):
424+
if type_traits.impl_details.is_defined_in_xxx(ns, decl):
416425
return cls_declaration
417426

418427
# This should not happen

pygccxml/declarations/declaration.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,6 @@ def parent(self, new_parent):
275275
if new_parent:
276276
assert(isinstance(new_parent, declaration_t))
277277

278-
# if new_parent.name == "tr1":
279-
# # When asking for the parent, consider that tr1 == std
280-
# # and silently replace tr1 by std.
281-
# if new_parent.parent.name == "std":
282-
# new_parent = new_parent.parent
283-
284278
self._parent = new_parent
285279

286280
@property

0 commit comments

Comments
 (0)