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
f9702604
Commit
f9702604
authored
Mar 23, 2018
by
Alex Huszagh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch to add front() and back(), as per issue #2123.
parent
8ff9c50d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
Cython/Includes/libcpp/string.pxd
Cython/Includes/libcpp/string.pxd
+2
-0
tests/run/cpp_stl_string_cpp11.pyx
tests/run/cpp_stl_string_cpp11.pyx
+16
-0
No files found.
Cython/Includes/libcpp/string.pxd
View file @
f9702604
...
...
@@ -63,6 +63,8 @@ cdef extern from "<string>" namespace "std" nogil:
char
&
at
(
size_t
)
char
&
operator
[](
size_t
)
char
&
front
()
char
&
back
()
int
compare
(
const
string
&
)
string
&
append
(
const
string
&
)
...
...
tests/run/cpp_stl_string_cpp11.pyx
0 → 100644
View file @
f9702604
# mode: run
# tag: cpp, werror, cpp11
# distutils: extra_compile_args=-std=c++11
from
libcpp.string
cimport
string
b_asdf
=
b'asdf'
def
test_element_access
(
char
*
py_str
):
"""
>>> test_element_access(b_asdf)
('a', 'f')
"""
cdef
string
s
s
=
string
(
py_str
)
return
chr
(
s
.
front
()),
chr
(
s
.
back
())
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