Improvement of the move semantics on various objects:

The source object will be empty after the move operation.
This commit is contained in:
bubnikv 2017-01-20 14:39:44 +01:00
parent d5f9db76b3
commit 29b986fa76
9 changed files with 79 additions and 52 deletions

View file

@ -47,10 +47,12 @@ class MultiPoint
void append(const Points::const_iterator &begin, const Points::const_iterator &end) { this->points.insert(this->points.end(), begin, end); }
void append(Points &&src)
{
if (this->points.empty())
if (this->points.empty()) {
this->points = std::move(src);
else
std::move(std::begin(src), std::end(src), std::back_inserter(this->points));
} else {
this->points.insert(this->points.end(), src.begin(), src.end());
src.clear();
}
}
bool intersection(const Line& line, Point* intersection) const;