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
3f884a1c
Commit
3f884a1c
authored
Aug 24, 2016
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
STL class value types.
parent
17e2f2c5
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
37 additions
and
1 deletion
+37
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+9
-0
Cython/Includes/libcpp/list.pxd
Cython/Includes/libcpp/list.pxd
+2
-0
Cython/Includes/libcpp/map.pxd
Cython/Includes/libcpp/map.pxd
+6
-1
Cython/Includes/libcpp/set.pxd
Cython/Includes/libcpp/set.pxd
+1
-0
Cython/Includes/libcpp/stack.pxd
Cython/Includes/libcpp/stack.pxd
+1
-0
Cython/Includes/libcpp/unordered_map.pxd
Cython/Includes/libcpp/unordered_map.pxd
+3
-0
Cython/Includes/libcpp/unordered_set.pxd
Cython/Includes/libcpp/unordered_set.pxd
+1
-0
Cython/Includes/libcpp/utility.pxd
Cython/Includes/libcpp/utility.pxd
+2
-0
Cython/Includes/libcpp/vector.pxd
Cython/Includes/libcpp/vector.pxd
+2
-0
tests/run/cpp_stl_vector.pyx
tests/run/cpp_stl_vector.pyx
+10
-0
No files found.
Cython/Compiler/PyrexTypes.py
View file @
3f884a1c
...
...
@@ -389,6 +389,15 @@ class CTypedefType(BaseType):
else
:
return
BaseType
.
cast_code
(
self
,
expr_code
)
def
specialize
(
self
,
values
):
base_type
=
self
.
typedef_base_type
.
specialize
(
values
)
namespace
=
self
.
typedef_namespace
.
specialize
(
values
)
if
self
.
typedef_namespace
else
None
if
base_type
is
self
.
typedef_base_type
and
namespace
is
self
.
typedef_namespace
:
return
self
else
:
return
CTypedefType
(
self
.
typedef_name
,
base_type
,
self
.
typedef_cname
,
self
.
typedef_is_external
,
namespace
)
def
__repr__
(
self
):
return
"<CTypedefType %s>"
%
self
.
typedef_cname
...
...
Cython/Includes/libcpp/list.pxd
View file @
3f884a1c
cdef
extern
from
"<list>"
namespace
"std"
nogil
:
cdef
cppclass
list
[
T
,
ALLOCATOR
=*
]:
ctypedef
T
value_type
ctypedef
ALLOCATOR
allocator_type
cppclass
iterator
:
iterator
()
iterator
(
iterator
&
)
...
...
Cython/Includes/libcpp/map.pxd
View file @
3f884a1c
from
.utility
cimport
pair
cdef
extern
from
"<map>"
namespace
"std"
nogil
:
cdef
cppclass
map
[
T
,
U
,
COMPARE
=*
,
ALLOCATOR
=*
]:
cdef
cppclass
map
[
T
,
U
,
COMPARE
=*
,
ALLOCATOR
=*
]:
ctypedef
T
key_type
ctypedef
U
mapped_type
ctypedef
pair
[
const
T
,
U
]
value_type
ctypedef
COMPARE
key_compare
ctypedef
ALLOCATOR
allocator_type
cppclass
iterator
:
pair
[
T
,
U
]
&
operator
*
()
iterator
operator
++
()
...
...
Cython/Includes/libcpp/set.pxd
View file @
3f884a1c
...
...
@@ -2,6 +2,7 @@ from .utility cimport pair
cdef
extern
from
"<set>"
namespace
"std"
nogil
:
cdef
cppclass
set
[
T
]:
ctypedef
T
value_type
cppclass
iterator
:
T
&
operator
*
()
iterator
operator
++
()
...
...
Cython/Includes/libcpp/stack.pxd
View file @
3f884a1c
cdef
extern
from
"<stack>"
namespace
"std"
nogil
:
ctypedef
T
value_type
cdef
cppclass
stack
[
T
]:
stack
()
except
+
stack
(
stack
&
)
except
+
...
...
Cython/Includes/libcpp/unordered_map.pxd
View file @
3f884a1c
...
...
@@ -2,6 +2,9 @@ from .utility cimport pair
cdef
extern
from
"<unordered_map>"
namespace
"std"
nogil
:
cdef
cppclass
unordered_map
[
T
,
U
]:
ctypedef
T
key_type
ctypedef
U
mapped_type
ctypedef
pair
[
const
T
,
U
]
value_type
cppclass
iterator
:
pair
[
T
,
U
]
&
operator
*
()
iterator
operator
++
()
...
...
Cython/Includes/libcpp/unordered_set.pxd
View file @
3f884a1c
...
...
@@ -2,6 +2,7 @@ from .utility cimport pair
cdef
extern
from
"<unordered_set>"
namespace
"std"
nogil
:
cdef
cppclass
unordered_set
[
T
,
HASH
=*
,
PRED
=*
,
ALLOCATOR
=*
]:
ctypedef
T
value_type
cppclass
iterator
:
T
&
operator
*
()
iterator
operator
++
()
...
...
Cython/Includes/libcpp/utility.pxd
View file @
3f884a1c
cdef
extern
from
"<utility>"
namespace
"std"
nogil
:
cdef
cppclass
pair
[
T
,
U
]:
ctypedef
T
first_type
ctypedef
U
second_type
T
first
U
second
pair
()
except
+
...
...
Cython/Includes/libcpp/vector.pxd
View file @
3f884a1c
cdef
extern
from
"<vector>"
namespace
"std"
nogil
:
cdef
cppclass
vector
[
T
,
ALLOCATOR
=*
]:
ctypedef
T
value_type
ctypedef
ALLOCATOR
allocator_type
cppclass
iterator
:
T
&
operator
*
()
iterator
operator
++
()
...
...
tests/run/cpp_stl_vector.pyx
View file @
3f884a1c
...
...
@@ -136,3 +136,13 @@ def item_ptr_test(L, int i, int x):
cdef
int
*
vi_ptr
=
&
v
[
i
]
vi_ptr
[
0
]
=
x
return
v
def
test_value_type
(
x
):
"""
>>> test_value_type(2)
2.0
>>> test_value_type(2.5)
2.5
"""
cdef
vector
[
double
].
value_type
val
=
x
return
val
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