Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
eeacfc75
Commit
eeacfc75
authored
Feb 20, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nested classes example.
parent
ccda96cb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
19 deletions
+36
-19
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-2
tests/run/cpp_stl.pyx
tests/run/cpp_stl.pyx
+35
-17
No files found.
Cython/Compiler/ExprNodes.py
View file @
eeacfc75
...
@@ -4230,8 +4230,7 @@ class UnopNode(ExprNode):
...
@@ -4230,8 +4230,7 @@ class UnopNode(ExprNode):
type
=
self
.
operand
.
type
type
=
self
.
operand
.
type
if
type
.
is_ptr
or
type
.
is_reference
:
if
type
.
is_ptr
or
type
.
is_reference
:
type
=
type
.
base_type
type
=
type
.
base_type
entry
=
env
.
lookup
(
type
.
name
)
function
=
type
.
scope
.
lookup
(
"operator%s"
%
self
.
operator
)
function
=
entry
.
type
.
scope
.
lookup
(
"operator%s"
%
self
.
operator
)
if
not
function
:
if
not
function
:
error
(
self
.
pos
,
"'%s' operator not defined for %s"
error
(
self
.
pos
,
"'%s' operator not defined for %s"
%
(
self
.
operator
,
type
))
%
(
self
.
operator
,
type
))
...
...
tests/run/cpp_stl.pyx
View file @
eeacfc75
__doc__
=
u"""
>>> test_vector([1,10,100])
1
10
100
"""
cdef
extern
from
"vector"
namespace
"std"
:
cdef
extern
from
"vector"
namespace
"std"
:
cdef
cppclass
iterator
[
T
]:
pass
cdef
cppclass
vector
[
T
]:
cdef
cppclass
vector
[
T
]:
#constructors
__init__
()
T
at
(
int
)
T
at
(
int
)
void
push_back
(
T
t
)
void
push_back
(
T
t
)
void
assign
(
int
,
T
)
void
assign
(
int
,
T
)
void
clear
()
void
clear
()
int
size
()
cppclass
iterator
:
T
operator
*
()
iterator
operator
++
()
bint
operator
==
(
iterator
)
bint
operator
!=
(
iterator
)
iterator
end
()
iterator
end
()
iterator
begin
()
iterator
begin
()
int
size
()
from
cython.operator
cimport
dereference
as
deref
,
preincrement
as
inc
def
test_vector
(
L
):
def
test_vector
(
L
):
cdef
vector
[
int
]
*
V
=
new
vector
[
int
]()
"""
>>> test_vector([1,10,100])
1
10
100
"""
v
=
new
vector
[
int
]()
for
a
in
L
:
for
a
in
L
:
V
.
push_back
(
a
)
v
.
push_back
(
a
)
cdef
int
i
cdef
int
i
for
i
in
range
(
len
(
L
)):
for
i
in
range
(
len
(
L
)):
print
V
.
at
(
i
)
print
v
.
at
(
i
)
del
V
del
v
def
test_vector_iterator
(
L
):
"""
>>> test_vector([11, 37, 389, 5077])
11
37
389
5077
"""
v
=
new
vector
[
int
]()
for
a
in
L
:
v
.
push_back
(
a
)
cdef
vector
[
int
].
iterator
iter
=
v
.
begin
()
while
iter
!=
v
.
end
():
print
deref
(
iter
)
inc
(
iter
)
del
v
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment