Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
47646980
Commit
47646980
authored
Sep 02, 2016
by
Jason Newton
Browse files
add move ctor and move-assignment operator
parent
514c6dad
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
include/pybind11/common.h
include/pybind11/common.h
+17
-0
No files found.
include/pybind11/common.h
View file @
47646980
...
@@ -235,6 +235,23 @@ struct buffer_info {
...
@@ -235,6 +235,23 @@ struct buffer_info {
}
}
}
}
buffer_info
(
buffer_info
&&
other
){
(
*
this
)
=
std
::
move
(
other
);
}
buffer_info
&
operator
=
(
buffer_info
&&
rhs
){
ptr
=
rhs
.
ptr
;
itemsize
=
rhs
.
itemsize
;
size
=
rhs
.
size
;
format
=
std
::
move
(
rhs
.
format
);
ndim
=
rhs
.
ndim
;
shape
=
std
::
move
(
rhs
.
shape
);
strides
=
std
::
move
(
rhs
.
strides
);
std
::
swap
(
view
,
rhs
.
view
);
std
::
swap
(
ownview
,
rhs
.
ownview
);
return
*
this
;
}
~
buffer_info
()
{
~
buffer_info
()
{
if
(
view
&&
ownview
)
{
PyBuffer_Release
(
view
);
delete
view
;
}
if
(
view
&&
ownview
)
{
PyBuffer_Release
(
view
);
delete
view
;
}
}
}
...
...
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