mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-20 15:40:45 +00:00
add move ctor and move-assignment operator
This commit is contained in:
parent
514c6dad70
commit
4764698069
@ -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() {
|
||||
if (view && ownview) { PyBuffer_Release(view); delete view; }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user