Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
stdlib
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cython-plus
stdlib
Commits
d75f957a
Commit
d75f957a
authored
Oct 07, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement list.pop()
parent
731f1925
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
list.pxd
list.pxd
+25
-0
No files found.
list.pxd
View file @
d75f957a
...
...
@@ -42,6 +42,31 @@ cdef cypclass List[V]:
with
gil
:
raise
IndexError
(
"Deleting list index out of range"
)
V
pop
(
self
)
except
~
:
if
self
.
_elements
.
size
()
==
0
:
with
gil
:
raise
IndexError
(
"Pop from empty list"
)
if
self
.
_active_iterators
!=
0
:
with
gil
:
raise
RuntimeError
(
"Modifying a list with active iterators"
)
value
=
self
.
_elements
.
back
()
self
.
_elements
.
pop_back
()
return
value
V
pop
(
self
,
size_type
index
)
except
~
:
if
index
<
self
.
_elements
.
size
():
if
self
.
_active_iterators
==
0
:
value
=
self
.
_elements
[
index
]
it
=
self
.
_elements
.
begin
()
+
index
self
.
_elements
.
erase
(
it
)
return
value
else
:
with
gil
:
raise
RuntimeError
(
"Modifying a list with active iterators"
)
else
:
with
gil
:
raise
IndexError
(
"Pop index out of range"
)
void
append
(
self
,
const
value_type
value
)
except
~
:
if
self
.
_active_iterators
==
0
:
self
.
_elements
.
push_back
(
value
)
...
...
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