-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify move constructors. #5409
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -339,7 +339,7 @@ class FilterBuffer { | |
shared_ptr<Buffer> underlying_buffer_; | ||
|
||
/** True if this instance is a view on the underlying buffer. */ | ||
bool is_view_{false}; | ||
bool is_view_; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
/** | ||
* If this instance is a view, the view Buffer (which does not own its | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,8 @@ FilterPipeline::FilterPipeline( | |
, max_chunk_size_(max_chunk_size) { | ||
} | ||
|
||
// Unlike move constructors, copy constructors must not use default, | ||
// because individual filters are being copied by calling clone. | ||
FilterPipeline::FilterPipeline(const FilterPipeline& other) { | ||
for (auto& filter : other.filters_) { | ||
add_filter(*filter); | ||
|
@@ -85,9 +87,7 @@ FilterPipeline::FilterPipeline( | |
max_chunk_size_ = other.max_chunk_size_; | ||
} | ||
|
||
FilterPipeline::FilterPipeline(FilterPipeline&& other) { | ||
swap(other); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same problem as before. The compiler looked through |
||
} | ||
FilterPipeline::FilterPipeline(FilterPipeline&& other) = default; | ||
|
||
FilterPipeline& FilterPipeline::operator=(const FilterPipeline& other) { | ||
// Call copy constructor | ||
|
@@ -97,10 +97,7 @@ FilterPipeline& FilterPipeline::operator=(const FilterPipeline& other) { | |
return *this; | ||
} | ||
|
||
FilterPipeline& FilterPipeline::operator=(FilterPipeline&& other) { | ||
swap(other); | ||
return *this; | ||
} | ||
FilterPipeline& FilterPipeline::operator=(FilterPipeline&& other) = default; | ||
|
||
void FilterPipeline::add_filter(const Filter& filter) { | ||
shared_ptr<Filter> copy(filter.clone()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were accessing
is_view_
while unititialized. A default move constructor suffices here.