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
Kirill Smelkov
cython
Commits
88ffe8bb
Commit
88ffe8bb
authored
Jul 06, 2018
by
scoder
Committed by
GitHub
Jul 06, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2445 from gabrieldemarmiesse/test_wrapping_cplusplus_4
Added tests for "Using C++ in Cython" part 4
parents
b4fa0cd9
05eaaa26
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
+17
-11
docs/examples/userguide/wrapping_CPlusPlus/vector_demo.pyx
docs/examples/userguide/wrapping_CPlusPlus/vector_demo.pyx
+15
-0
docs/src/userguide/wrapping_CPlusPlus.rst
docs/src/userguide/wrapping_CPlusPlus.rst
+2
-11
No files found.
docs/examples/userguide/wrapping_CPlusPlus/vector_demo.pyx
0 → 100644
View file @
88ffe8bb
# distutils: language = c++
from
libcpp.vector
cimport
vector
cdef
vector
[
int
]
vect
cdef
int
i
,
x
for
i
in
range
(
10
):
vect
.
push_back
(
i
)
for
i
in
range
(
10
):
print
(
vect
[
i
])
for
x
in
vect
:
print
(
x
)
docs/src/userguide/wrapping_CPlusPlus.rst
View file @
88ffe8bb
...
...
@@ -355,18 +355,9 @@ Most of the containers of the C++ Standard Library have been declared
in pxd files located in ``/Cython/Includes/libcpp``. These containers
are: deque, list, map, pair, queue, set, stack, vector.
For example:
:
For example:
from libcpp.vector cimport vector
cdef vector[int] vect
cdef int i, x
for i in range(10):
vect.push_back(i)
for i in range(10):
print(vect[i])
for x in vect:
print(x)
.. literalinclude:: ../../examples/userguide/wrapping_CPlusPlus/vector_demo.pyx
The pxd files in ``/Cython/Includes/libcpp`` also work as good examples on
how to declare C++ classes.
...
...
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