Skip to content

Commit 36b7930

Browse files
mamolliMichka
authored andcommitted
classify std::shared_ptr as a smart pointer
Cherry-pick from develop branch
1 parent bbe4684 commit 36b7930

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pygccxml/declarations/type_traits.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,24 +1166,28 @@ class smart_pointer_traits(object):
11661166
@staticmethod
11671167
def is_smart_pointer(type_):
11681168
"""returns True, if type represents instantiation of
1169-
`boost::shared_ptr`, False otherwise"""
1169+
`boost::shared_ptr` or `std::shared_ptr`, False otherwise"""
11701170
type_ = remove_alias(type_)
11711171
type_ = remove_cv(type_)
11721172
type_ = remove_declarated(type_)
11731173
if not isinstance(type_,
11741174
(class_declaration.class_declaration_t,
11751175
class_declaration.class_t)):
11761176
return False
1177-
if not impl_details.is_defined_in_xxx('boost', type_):
1177+
if not (impl_details.is_defined_in_xxx('boost', type_) or \
1178+
impl_details.is_defined_in_xxx('std', type_)):
11781179
return False
1179-
return type_.decl_string.startswith('::boost::shared_ptr<')
1180+
return type_.decl_string.startswith('::boost::shared_ptr<') or \
1181+
type_.decl_string.startswith('::std::shared_ptr<')
11801182

11811183
@staticmethod
11821184
def value_type(type_):
1183-
"""returns reference to `boost::shared_ptr` value type"""
1185+
"""returns reference to `boost::shared_ptr` \
1186+
or `std::shared_ptr` value type"""
11841187
if not smart_pointer_traits.is_smart_pointer(type_):
11851188
raise TypeError(
1186-
'Type "%s" is not instantiation of boost::shared_ptr' %
1189+
'Type "%s" is not an instantiation of \
1190+
boost::shared_ptr or std::shared_ptr' %
11871191
type_.decl_string)
11881192
return internal_type_traits.get_by_name(type_, "value_type")
11891193

0 commit comments

Comments
 (0)