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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
b3ee89c7
Commit
b3ee89c7
authored
Nov 18, 2014
by
root
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/cython/cython
parents
758333e9
4bd204aa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
0 deletions
+35
-0
Cython/Includes/libcpp/unordered_map.pxd
Cython/Includes/libcpp/unordered_map.pxd
+2
-0
docs/src/userguide/external_C_code.rst
docs/src/userguide/external_C_code.rst
+2
-0
docs/src/userguide/wrapping_CPlusPlus.rst
docs/src/userguide/wrapping_CPlusPlus.rst
+31
-0
No files found.
Cython/Includes/libcpp/unordered_map.pxd
View file @
b3ee89c7
...
@@ -60,3 +60,5 @@ cdef extern from "<unordered_map>" namespace "std" nogil:
...
@@ -60,3 +60,5 @@ cdef extern from "<unordered_map>" namespace "std" nogil:
iterator
upper_bound
(
T
&
)
iterator
upper_bound
(
T
&
)
#const_iterator upper_bound(key_type&)
#const_iterator upper_bound(key_type&)
#value_compare value_comp()
#value_compare value_comp()
void
max_load_factor
(
float
)
float
max_load_factor
()
docs/src/userguide/external_C_code.rst
View file @
b3ee89c7
...
@@ -214,6 +214,8 @@ If ``__stdcall`` is used, the function is only considered compatible with
...
@@ -214,6 +214,8 @@ If ``__stdcall`` is used, the function is only considered compatible with
other ``__stdcall`` functions of the same signature.
other ``__stdcall`` functions of the same signature.
.. _resolve-conflicts:
Resolving naming conflicts - C name specifications
Resolving naming conflicts - C name specifications
--------------------------------------------------
--------------------------------------------------
...
...
docs/src/userguide/wrapping_CPlusPlus.rst
View file @
b3ee89c7
...
@@ -283,6 +283,9 @@ attribute access, you could just implement some properties::
...
@@ -283,6 +283,9 @@ attribute access, you could just implement some properties::
def __set__(self, x0): self.thisptr.x0 = x0
def __set__(self, x0): self.thisptr.x0 = x0
...
...
If you prefer giving the same name to the wrapper as the C++ class, see the
section on :ref:`resolving naming conflicts <resolve-conflicts>`.
Advanced C++ features
Advanced C++ features
======================
======================
...
@@ -477,6 +480,34 @@ The items in the containers are converted to a corresponding type
...
@@ -477,6 +480,34 @@ The items in the containers are converted to a corresponding type
automatically, which includes recursively converting containers
automatically, which includes recursively converting containers
inside of containers, e.g. a C++ vector of maps of strings.
inside of containers, e.g. a C++ vector of maps of strings.
Simplified wrapping with default constructor
--------------------------------------------
If your extension type instantiates a wrapped C++ class using the default
constructor (not passing any arguments), you may be able to simplify the
lifecycle handling by tying it directly to the lifetime of the Python wrapper
object. Instead of a pointer attribute, you can declare an instance::
cdef class VectorStack:
cdef vector[int] v
def push(self, x):
self.v.push_back(x)
def pop(self):
if self.v.empty():
raise IndexError()
x = self.v.back()
self.v.pop_back()
return x
Cython will automatically generate code that instantiates the C++ object
instance when the Python object is created and deletes it when the Python
object is garbage collected.
Exceptions
Exceptions
-----------
-----------
...
...
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