Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
e97c735f
Commit
e97c735f
authored
Jan 17, 2020
by
fwjavox
Committed by
Wenzel Jakob
Jan 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stl_bind: add binding for std::vector::clear (#2074)
parent
07e22593
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
include/pybind11/stl_bind.h
+7
-0
tests/test_stl_binders.py
+3
-0
No files found.
include/pybind11/stl_bind.h
View file @
e97c735f
...
@@ -136,6 +136,13 @@ void vector_modifiers(enable_if_t<is_copy_constructible<typename Vector::value_t
...
@@ -136,6 +136,13 @@ void vector_modifiers(enable_if_t<is_copy_constructible<typename Vector::value_t
return
v
.
release
();
return
v
.
release
();
}));
}));
cl
.
def
(
"clear"
,
[](
Vector
&
v
)
{
v
.
clear
();
},
"Clear the contents"
);
cl
.
def
(
"extend"
,
cl
.
def
(
"extend"
,
[](
Vector
&
v
,
const
Vector
&
src
)
{
[](
Vector
&
v
,
const
Vector
&
src
)
{
v
.
insert
(
v
.
end
(),
src
.
begin
(),
src
.
end
());
v
.
insert
(
v
.
end
(),
src
.
begin
(),
src
.
end
());
...
...
tests/test_stl_binders.py
View file @
e97c735f
...
@@ -64,6 +64,9 @@ def test_vector_int():
...
@@ -64,6 +64,9 @@ def test_vector_int():
del
v_int2
[
-
1
]
del
v_int2
[
-
1
]
assert
v_int2
==
m
.
VectorInt
([
0
,
99
,
2
,
3
,
4
,
5
,
6
,
7
,
0
,
1
,
2
,
3
,
88
])
assert
v_int2
==
m
.
VectorInt
([
0
,
99
,
2
,
3
,
4
,
5
,
6
,
7
,
0
,
1
,
2
,
3
,
88
])
v_int2
.
clear
()
assert
len
(
v_int2
)
==
0
# related to the PyPy's buffer protocol.
# related to the PyPy's buffer protocol.
@pytest.unsupported_on_pypy
@pytest.unsupported_on_pypy
def
test_vector_buffer
():
def
test_vector_buffer
():
...
...
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