diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2017-10-09 14:59:01 +0300 |
---|---|---|
committer | Roman Kuznetsov <r.kuznetsow@gmail.com> | 2017-10-17 15:16:05 +0300 |
commit | f3b47f6e4864396c91078985a1f1e3ccdaeeeca0 (patch) | |
tree | b6474353191cadfa7baffeaa56ce47a0abeb6263 /geometry | |
parent | c34018bfb2e1d86594a391ee1229d4a97316028f (diff) |
Review fixes
Diffstat (limited to 'geometry')
-rw-r--r-- | geometry/polyline2d.hpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/geometry/polyline2d.hpp b/geometry/polyline2d.hpp index 11b3442b0b..f214b72e4d 100644 --- a/geometry/polyline2d.hpp +++ b/geometry/polyline2d.hpp @@ -133,17 +133,15 @@ public: vector<Point<T>> ExtractSegment(size_t startPointIndex, size_t endPointIndex) const { - if (startPointIndex > endPointIndex || - startPointIndex + 1 > m_points.size() || - endPointIndex + 1 > m_points.size()) + if (startPointIndex > endPointIndex || startPointIndex >= m_points.size() || + endPointIndex >= m_points.size()) { return vector<Point<T>>(); } - vector<Point<T>> result; - result.reserve(endPointIndex - startPointIndex + 1); + vector<Point<T>> result(endPointIndex - startPointIndex + 1); for (size_t i = startPointIndex; i <= endPointIndex; ++i) - result.push_back(m_points[i]); + result[i] = m_points[i]; return result; } |