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
8d47713c
Commit
8d47713c
authored
Feb 25, 2012
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for C++ template pointer casting and assignment
parent
8f91ac8b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
tests/run/cpp_templates.pyx
tests/run/cpp_templates.pyx
+16
-0
tests/run/cpp_templates_helper.h
tests/run/cpp_templates_helper.h
+10
-0
No files found.
tests/run/cpp_templates.pyx
View file @
8d47713c
...
...
@@ -16,6 +16,12 @@ cdef extern from "cpp_templates_helper.h":
bint
operator
==
(
Pair
[
T1
,
T2
])
bint
operator
!=
(
Pair
[
T1
,
T2
])
cdef
cppclass
SuperClass
[
T1
,
T2
]:
pass
cdef
cppclass
SubClass
[
T2
,
T3
]:
pass
def
test_int
(
int
x
,
int
y
):
"""
>>> test_int(3, 4)
...
...
@@ -88,3 +94,13 @@ def test_func_ptr(double x):
return
w
.
get
()(
x
)
finally
:
del
w
def
test_cast_template_pointer
():
"""
>>> test_cast_template_pointer()
"""
cdef
SubClass
[
int
,
float
]
*
sub
=
new
SubClass
[
int
,
float
]()
cdef
SuperClass
[
int
,
float
]
*
sup
sup
=
sub
sup
=
<
SubClass
[
int
,
float
]
*>
sub
tests/run/cpp_templates_helper.h
View file @
8d47713c
...
...
@@ -20,3 +20,13 @@ public:
bool
operator
==
(
Pair
<
T1
,
T2
>
other
)
{
return
_first
==
other
.
_first
&&
_second
==
other
.
_second
;
}
bool
operator
!=
(
Pair
<
T1
,
T2
>
other
)
{
return
_first
!=
other
.
_first
||
_second
!=
other
.
_second
;
}
};
template
<
class
T1
,
class
T2
>
class
SuperClass
{
public:
SuperClass
()
{}
};
template
<
class
T2
,
class
T3
>
class
SubClass
:
public
SuperClass
<
T2
,
T3
>
{
};
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