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
Boxiang Sun
cython
Commits
8baa9dba
Commit
8baa9dba
authored
Aug 23, 2014
by
Lars Buitinck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix nested C++ template syntax
parent
07c422a5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+1
-3
tests/compile/cpp_templates.pyx
tests/compile/cpp_templates.pyx
+10
-0
tests/compile/templates.h
tests/compile/templates.h
+5
-0
No files found.
Cython/Compiler/PyrexTypes.py
View file @
8baa9dba
...
...
@@ -3153,10 +3153,8 @@ class CppClassType(CType):
if
for_display
:
brackets
=
"[%s]"
else
:
brackets
=
"<%s>"
brackets
=
"<%s>
"
templates
=
brackets
%
","
.
join
(
template_strings
)
if
templates
[
-
2
:]
==
">>"
:
templates
=
templates
[:
-
2
]
+
"> >"
else
:
templates
=
""
if
pyrex
or
for_display
:
...
...
tests/compile/cpp_templates.pyx
View file @
8baa9dba
...
...
@@ -16,6 +16,8 @@ cdef extern from "templates.h":
T
getValue1
()
U
getValue2
()
void
template_function
[
T
](
TemplateTest1
[
T
]
&
)
cdef
TemplateTest1
[
int
]
a
cdef
TemplateTest1
[
int
]
*
b
=
new
TemplateTest1
[
int
]()
...
...
@@ -39,3 +41,11 @@ cdef TemplateTest1_int aa
# Verify that T767 is fixed.
cdef
public
int
func
(
int
arg
):
return
arg
# Regression test: the function call used to produce
# template_function<TemplateTest1<int>>(__pyx_v_t);
# which is valid C++11, but not valid C++98 because the ">>" would be
# parsed as a single token.
cdef
public
void
use_nested_templates
():
cdef
TemplateTest1
[
TemplateTest1
[
int
]]
t
template_function
(
t
)
tests/compile/templates.h
View file @
8baa9dba
...
...
@@ -22,4 +22,9 @@ public:
U
getValue2
()
{
return
value2
;
}
};
template
<
typename
T
>
void
template_function
(
TemplateTest1
<
T
>
&
)
{
}
#endif
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