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
57385bf9
Commit
57385bf9
authored
Jul 06, 2018
by
scoder
Committed by
GitHub
Jul 06, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2441 from gabrieldemarmiesse/test_wrapping_cplusplus_1
Added tests for "Using C++ in Cython" part 1
parents
3623e6c7
af8b69ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
17 deletions
+20
-17
docs/examples/userguide/wrapping_CPlusPlus/nested_class.pyx
docs/examples/userguide/wrapping_CPlusPlus/nested_class.pyx
+17
-0
docs/src/userguide/wrapping_CPlusPlus.rst
docs/src/userguide/wrapping_CPlusPlus.rst
+3
-17
No files found.
docs/examples/userguide/wrapping_CPlusPlus/nested_class.pyx
0 → 100644
View file @
57385bf9
# distutils: language = c++
cdef
extern
from
"<vector>"
namespace
"std"
:
cdef
cppclass
vector
[
T
]:
cppclass
iterator
:
T
operator
*
()
iterator
operator
++
()
bint
operator
==
(
iterator
)
bint
operator
!=
(
iterator
)
vector
()
void
push_back
(
T
&
)
T
&
operator
[](
int
)
T
&
at
(
int
)
iterator
begin
()
iterator
end
()
cdef
vector
[
int
].
iterator
iter
#iter is declared as being of type vector<int>::iterator
docs/src/userguide/wrapping_CPlusPlus.rst
View file @
57385bf9
...
@@ -252,23 +252,9 @@ themselves::
...
@@ -252,23 +252,9 @@ themselves::
Nested class declarations
Nested class declarations
--------------------------
--------------------------
C++ allows nested class declaration. Class declarations can also be
C++ allows nested class declaration. Class declarations can also be
nested in Cython::
nested in Cython:
cdef extern from "<vector>" namespace "std":
.. literalinclude:: ../../examples/userguide/wrapping_CPlusPlus/nested_class.pyx
cdef cppclass vector[T]:
cppclass iterator:
T operator*()
iterator operator++()
bint operator==(iterator)
bint operator!=(iterator)
vector()
void push_back(T&)
T& operator[](int)
T& at(int)
iterator begin()
iterator end()
cdef vector[int].iterator iter #iter is declared as being of type vector<int>::iterator
Note that the nested class is declared with a ``cppclass`` but without a ``cdef``.
Note that the nested class is declared with a ``cppclass`` but without a ``cdef``.
...
...
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