diff options
author | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2016-10-20 18:20:24 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2016-11-02 11:06:37 +0300 |
commit | ef4f16a36b98c5ea63734b550fdf52ec435da085 (patch) | |
tree | 754e10c67fdcf974c4b367c2793704fb6e4d368f /geometry | |
parent | 9d7d305e4ff2edae80aacce5b0c91b0bf734dbe4 (diff) |
Review fixes.
Diffstat (limited to 'geometry')
-rw-r--r-- | geometry/polyline2d.hpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/geometry/polyline2d.hpp b/geometry/polyline2d.hpp index 701f888192..1c67c258a7 100644 --- a/geometry/polyline2d.hpp +++ b/geometry/polyline2d.hpp @@ -13,21 +13,21 @@ namespace m2 { template <typename T> -class PolylineT +class Polyline { vector<Point<T> > m_points; public: - PolylineT() {} - PolylineT(initializer_list<Point<T> > points) : m_points(points) + Polyline() {} + Polyline(initializer_list<Point<T> > points) : m_points(points) { ASSERT_GREATER(m_points.size(), 1, ()); } - explicit PolylineT(vector<Point<T> > const & points) : m_points(points) + explicit Polyline(vector<Point<T> > const & points) : m_points(points) { ASSERT_GREATER(m_points.size(), 1, ()); } - template <class IterT> PolylineT(IterT beg, IterT end) : m_points(beg, end) + template <class IterT> Polyline(IterT beg, IterT end) : m_points(beg, end) { ASSERT_GREATER(m_points.size(), 1, ()); } @@ -68,25 +68,25 @@ public: void Clear() { m_points.clear(); } void Add(Point<T> const & pt) { m_points.push_back(pt); } - void Append(PolylineT const & poly) + void Append(Polyline const & poly) { m_points.insert(m_points.end(), poly.m_points.cbegin(), poly.m_points.cend()); } void PopBack() { - if (!m_points.empty()) - m_points.pop_back(); + ASSERT(!m_points.empty(), ()); + m_points.pop_back(); } - void Swap(PolylineT & rhs) + void Swap(Polyline & rhs) { m_points.swap(rhs.m_points); } size_t GetSize() const { return m_points.size(); } - bool operator==(PolylineT<T> const & rhs) const { return m_points == rhs.m_points; } + bool operator==(Polyline<T> const & rhs) const { return m_points == rhs.m_points; } typedef vector<Point<T> > TContainer; typedef typename TContainer::const_iterator TIter; @@ -123,12 +123,11 @@ public: vector<Point<T> > const & GetPoints() const { return m_points; } - friend string DebugPrint(PolylineT<T> const & p) + friend string DebugPrint(Polyline<T> const & p) { return ::DebugPrint(p.m_points); } }; -typedef PolylineT<double> PolylineD; - -} +typedef Polyline<double> PolylineD; +} // namespace m2 |