From dde61c1ca21e80bc2a849b2c9fd1c36c9d5760f9 Mon Sep 17 00:00:00 2001 From: Sergey Yershov Date: Thu, 1 Oct 2015 11:57:54 +0300 Subject: [PATCH] Review fix --- generator/tesselator.cpp | 16 ++++++++-------- generator/tesselator.hpp | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/generator/tesselator.cpp b/generator/tesselator.cpp index 0db93073cd..9d3d860646 100644 --- a/generator/tesselator.cpp +++ b/generator/tesselator.cpp @@ -19,8 +19,8 @@ namespace tesselator { int TesselateInterior(PolygonsT const & polys, TrianglesInfo & info) { - int const kCoordinatesPerVertex = 2; - int const kVerticesInPolygon = 3; + int constexpr kCoordinatesPerVertex = 2; + int constexpr kVerticesInPolygon = 3; auto const deleter = [](TESStesselator * tess) {tessDeleteTess(tess);}; unique_ptr tess(tessNewTess(nullptr), deleter); @@ -89,13 +89,13 @@ int TesselateInterior(PolygonsT const & polys, TrianglesInfo & info) } /// Find best (cheap in serialization) start edge for processing. - TrianglesInfo::ListInfo::iter_t + TrianglesInfo::ListInfo::TIterator TrianglesInfo::ListInfo::FindStartTriangle(PointsInfo const & points) const { - iter_t ret = m_neighbors.end(); + TIterator ret = m_neighbors.end(); size_t cr = numeric_limits::max(); - for (iter_t i = m_neighbors.begin(); i != m_neighbors.end(); ++i) + for (TIterator i = m_neighbors.begin(); i != m_neighbors.end(); ++i) { if (!m_visited[i->second] && m_neighbors.find(make_pair(i->first.second, i->first.first)) == m_neighbors.end()) @@ -146,7 +146,7 @@ int TesselateInterior(PolygonsT const & polys, TrianglesInfo & info) int j = my::NextModN(i, 3); int ind = 0; - iter_t it = m_neighbors.find(make_pair(trg.m_p[j], trg.m_p[i])); + TIterator it = m_neighbors.find(make_pair(trg.m_p[j], trg.m_p[i])); nb[ind++] = (it != m_neighbors.end()) ? it->second : empty_key; it = m_neighbors.find(make_pair(trg.m_p[my::NextModN(j, 3)], trg.m_p[j])); @@ -173,7 +173,7 @@ int TesselateInterior(PolygonsT const & polys, TrianglesInfo & info) template void TrianglesInfo::ListInfo::MakeTrianglesChainImpl( - PointsInfo const & points, iter_t start, vector & chain) const + PointsInfo const & points, TIterator start, vector & chain) const { chain.clear(); @@ -228,7 +228,7 @@ int TesselateInterior(PolygonsT const & polys, TrianglesInfo & info) }; void TrianglesInfo::ListInfo::MakeTrianglesChain( - PointsInfo const & points, iter_t start, vector & chain, bool /*goodOrder*/) const + PointsInfo const & points, TIterator start, vector & chain, bool /*goodOrder*/) const { //if (goodOrder) MakeTrianglesChainImpl(points, start, chain); diff --git a/generator/tesselator.hpp b/generator/tesselator.hpp index 1fc5ac2b1a..753862d0ef 100644 --- a/generator/tesselator.hpp +++ b/generator/tesselator.hpp @@ -72,7 +72,7 @@ namespace tesselator } }; - typedef unordered_map, int, HashPair> TNeighbours; + using TNeighbours = unordered_map, int, HashPair>; TNeighbours m_neighbors; void AddNeighbour(int p1, int p2, int trg); @@ -84,7 +84,7 @@ namespace tesselator PointsInfo const & points, Triangle const & from, Triangle const & to) const; public: - typedef TNeighbours::const_iterator iter_t; + using TIterator = TNeighbours::const_iterator; ListInfo(size_t count) { @@ -105,13 +105,13 @@ namespace tesselator return (m_visited != test); } - iter_t FindStartTriangle(PointsInfo const & points) const; + TIterator FindStartTriangle(PointsInfo const & points) const; private: template - void MakeTrianglesChainImpl(PointsInfo const & points, iter_t start, vector & chain) const; + void MakeTrianglesChainImpl(PointsInfo const & points, TIterator start, vector & chain) const; public: - void MakeTrianglesChain(PointsInfo const & points, iter_t start, vector & chain, bool goodOrder) const; + void MakeTrianglesChain(PointsInfo const & points, TIterator start, vector & chain, bool goodOrder) const; size_t GetCount() const { return m_triangles.size(); } Triangle GetTriangle(size_t i) const { return m_triangles[i]; } @@ -167,7 +167,7 @@ namespace tesselator do { - typename ListInfo::iter_t start = i->FindStartTriangle(points); + typename ListInfo::TIterator start = i->FindStartTriangle(points); i->MakeTrianglesChain(points, start, chain, goodOrder); m2::PointU arr[] = { points.m_points[start->first.first],