Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2017-01-20 16:39:44 +0300
committerbubnikv <bubnikv@gmail.com>2017-01-20 16:39:44 +0300
commit29b986fa76e0725b02fdf58e083c5b93dffbbacd (patch)
treee6982e4dd1602eafb1aabd5d2f11598dcf09f20c /xs/src/libslic3r/Surface.hpp
parentd5f9db76b3bef6fb81d7110226568e94a9ec666f (diff)
Improvement of the move semantics on various objects:
The source object will be empty after the move operation.
Diffstat (limited to 'xs/src/libslic3r/Surface.hpp')
-rw-r--r--xs/src/libslic3r/Surface.hpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/xs/src/libslic3r/Surface.hpp b/xs/src/libslic3r/Surface.hpp
index 9ad86d0ed..d64607ff5 100644
--- a/xs/src/libslic3r/Surface.hpp
+++ b/xs/src/libslic3r/Surface.hpp
@@ -143,16 +143,15 @@ inline void polygons_append(Polygons &dst, const Surfaces &src)
}
}
-#if SLIC3R_CPPVER >= 11
inline void polygons_append(Polygons &dst, Surfaces &&src)
{
dst.reserve(dst.size() + number_polygons(src));
- for (Surfaces::const_iterator it = src.begin(); it != src.end(); ++ it) {
+ for (Surfaces::iterator it = src.begin(); it != src.end(); ++ it) {
dst.push_back(std::move(it->expolygon.contour));
std::move(std::begin(it->expolygon.holes), std::end(it->expolygon.holes), std::back_inserter(dst));
+ it->expolygon.holes.clear();
}
}
-#endif
// Append a vector of Surfaces at the end of another vector of polygons.
inline void polygons_append(Polygons &dst, const SurfacesPtr &src)
@@ -164,16 +163,15 @@ inline void polygons_append(Polygons &dst, const SurfacesPtr &src)
}
}
-#if SLIC3R_CPPVER >= 11
inline void polygons_append(Polygons &dst, SurfacesPtr &&src)
{
dst.reserve(dst.size() + number_polygons(src));
for (SurfacesPtr::const_iterator it = src.begin(); it != src.end(); ++ it) {
dst.push_back(std::move((*it)->expolygon.contour));
std::move(std::begin((*it)->expolygon.holes), std::end((*it)->expolygon.holes), std::back_inserter(dst));
+ (*it)->expolygon.holes.clear();
}
}
-#endif
// Append a vector of Surfaces at the end of another vector of polygons.
inline void surfaces_append(Surfaces &dst, const ExPolygons &src, SurfaceType surfaceType)
@@ -193,27 +191,30 @@ inline void surfaces_append(Surfaces &dst, const Surfaces &src)
dst.insert(dst.end(), src.begin(), src.end());
}
-#if SLIC3R_CPPVER >= 11
inline void surfaces_append(Surfaces &dst, ExPolygons &&src, SurfaceType surfaceType)
{
dst.reserve(dst.size() + src.size());
for (ExPolygons::const_iterator it = src.begin(); it != src.end(); ++ it)
dst.push_back(Surface(surfaceType, std::move(*it)));
+ src.clear();
}
+
inline void surfaces_append(Surfaces &dst, ExPolygons &&src, const Surface &surfaceTempl)
{
dst.reserve(dst.size() + number_polygons(src));
for (ExPolygons::const_iterator it = src.begin(); it != src.end(); ++ it)
dst.push_back(Surface(surfaceTempl, std::move(*it)));
+ src.clear();
}
inline void surfaces_append(Surfaces &dst, Surfaces &&src)
{
- if (dst.empty())
+ if (dst.empty()) {
dst = std::move(src);
- else
+ } else {
std::move(std::begin(src), std::end(src), std::back_inserter(dst));
+ src.clear();
+ }
}
-#endif
extern BoundingBox get_extents(const Surface &surface);
extern BoundingBox get_extents(const Surfaces &surfaces);