diff --git a/BGL/include/CGAL/boost/graph/Euler_operations.h b/BGL/include/CGAL/boost/graph/Euler_operations.h index 4dc515df562..f6de520d367 100644 --- a/BGL/include/CGAL/boost/graph/Euler_operations.h +++ b/BGL/include/CGAL/boost/graph/Euler_operations.h @@ -783,7 +783,7 @@ void add_faces(const RangeofVertexRange& faces_to_add, PolygonMesh& pm) typedef boost::container::small_vector Halfedges; #else //typedef boost::unordered_map > Halfedges; - typedef Small_unordered_mapV2 Halfedges; + typedef Small_unordered_mapV2 Halfedges; #endif typedef typename CGAL::GetInitializedVertexIndexMap::type Vid_map; @@ -808,8 +808,12 @@ void add_faces(const RangeofVertexRange& faces_to_add, PolygonMesh& pm) std::vector former_border_hedges; //TODO: use vertex index map for v -> vector +#ifdef SV std::vector outgoing_hedges(num_vertices(pm)); - +#else + std::vector outgoing_hedges(num_vertices(pm),Halfedges(pm)); +#endif + for (const Vertex_range& vr : faces_to_add) { std::size_t nbh=vr.size(); diff --git a/STL_Extension/include/CGAL/Small_unordered_mapV2.h b/STL_Extension/include/CGAL/Small_unordered_mapV2.h index db14648696a..33174cce265 100644 --- a/STL_Extension/include/CGAL/Small_unordered_mapV2.h +++ b/STL_Extension/include/CGAL/Small_unordered_mapV2.h @@ -21,16 +21,19 @@ namespace CGAL { -template +template class Small_unordered_mapV2 { - std::array, M> data; + const Mesh& mesh; + // std::array, M> data; + std::array data; boost::unordered_map * big = nullptr; int N = 0; // the number of stored elements public: - Small_unordered_mapV2() + Small_unordered_mapV2(const Mesh& mesh) + : mesh(mesh) {} @@ -46,14 +49,16 @@ public: void set(const K& k, const T& t) { if (N < M) { - data[N].first = k; - data[N].second = t; + //data[N].first = k; + //data[N].second = t; + data[N] = t; ++N; }else{ if (N == M) { big = new boost::unordered_map(); for(int pos = 0; pos < M; ++pos){ - big->insert(data[pos]); + // big->insert(data[pos]); + big->insert(std::make_pair(target(data[pos],mesh),data[pos])); } (*big)[k] = t; }else{ @@ -77,7 +82,7 @@ public: { if (N <= M) { for(int i =0; i < M; ++i){ - if (data[i].first == k) { + if (target(data[i],mesh) == k) { return const_iterator(*this,i); } } @@ -163,7 +168,7 @@ public: return *bigit; } else { - return map.data[pos]; + return std::make_pair(target(map.data[pos],map.mesh),map.data[pos]); } } };