diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index f3cd2f206e7..3ebbe70f809 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -245,8 +245,8 @@ public: m_base = ps.m_base; m_indices = this->property_map ("index").value(); m_points = this->property_map ("point").value(); - m_normals = this->property_map ("normal").value(); m_nb_removed = ps.m_nb_removed; + copy_properties(ps); return *this; } @@ -257,7 +257,7 @@ public: m_base = ps.m_base; m_indices = this->property_map ("index").value(); m_points = this->property_map ("point").value(); - m_normals = this->property_map ("normal").value(); + copy_properties(ps); m_nb_removed = ps.m_nb_removed; } /// \endcond diff --git a/Point_set_3/test/Point_set_3/point_set_test.cpp b/Point_set_3/test/Point_set_3/point_set_test.cpp index b745fe6e94e..086feabface 100644 --- a/Point_set_3/test/Point_set_3/point_set_test.cpp +++ b/Point_set_3/test/Point_set_3/point_set_test.cpp @@ -28,6 +28,26 @@ void test (bool expr, const char* msg) ++ nb_success; } +bool copy_and_assignement() +{ + Point_set ps1; + ps1.add_property_map("prop", int(3)); + ps1.add_normal_map(); + Point_set ps2 = ps1; + if (!ps2.has_property_map("prop")) return false; + if (!ps2.has_normal_map()) return false; + Point_set ps3(ps1); + if (!ps3.has_property_map("prop")) return false; + if (!ps3.has_normal_map()) return false; + ps1=Point_set(); + Point_set ps4 = ps1; + if (ps4.has_property_map("prop")) return false; + if (ps4.has_normal_map()) return false; + Point_set ps5(ps1); + if (ps5.has_property_map("prop")) return false; + if (ps5.has_normal_map()) return false; + return true; +} int main (int, char**) { @@ -130,7 +150,9 @@ int main (int, char**) std::unordered_set std_hash; boost::unordered_set boost_hash; + test(copy_and_assignement(), "copy and assignement"); + std::cerr << nb_success << "/" << nb_test << " test(s) succeeded." << std::endl; - return EXIT_SUCCESS; + return nb_success==nb_test ? EXIT_SUCCESS : EXIT_FAILURE; }