Commit a192940f authored by Xavier Thompson's avatar Xavier Thompson

Generate const-correct cpp iterations when possible

parent 927a7dbf
...@@ -2878,6 +2878,14 @@ class CppIteratorNode(ExprNode): ...@@ -2878,6 +2878,14 @@ class CppIteratorNode(ExprNode):
sequence_type = self.sequence.type sequence_type = self.sequence.type
if sequence_type.is_ptr: if sequence_type.is_ptr:
sequence_type = sequence_type.base_type sequence_type = sequence_type.base_type
if sequence_type.is_const or sequence_type.is_const_cyp_class:
begin = sequence_type.scope.lookup("const_begin")
end = sequence_type.scope.lookup("const_end")
if not begin or begin.cname != "begin":
begin = sequence_type.scope.lookup("begin")
if not end or end.cname != "end":
end = sequence_type.scope.lookup("end")
else:
begin = sequence_type.scope.lookup("begin") begin = sequence_type.scope.lookup("begin")
end = sequence_type.scope.lookup("end") end = sequence_type.scope.lookup("end")
if (begin is None if (begin is None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment