From 916e48284dfdbee09fdece26c8ada94559013ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 13 Jul 2022 12:48:27 +0200 Subject: [PATCH] add an extra overload of choose_parameter for dynamic property maps --- .../test_pmp_np_function.cpp | 2 +- .../include/CGAL/Named_function_parameters.h | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_np_function.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_np_function.cpp index dc7424386ac..a9b59a6ffaa 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_np_function.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_np_function.cpp @@ -53,7 +53,7 @@ void my_function_with_named_parameters(PolygonMesh& mesh, const NamedParameters& bool do_project = choose_parameter(get_parameter(np, internal_np::do_project), false); // If the NPs provide a vertex-normal-map use it, otherwise initialize the default one - VNM vnm = choose_parameter(get_parameter(np, internal_np::vertex_normal_map), get(Vector_map_tag(), mesh)); + VNM vnm = choose_parameter(get_parameter(np, internal_np::vertex_normal_map), Vector_map_tag(), mesh); if (is_default_parameter::value) Polygon_mesh_processing::compute_vertex_normals(mesh, vnm); diff --git a/STL_Extension/include/CGAL/Named_function_parameters.h b/STL_Extension/include/CGAL/Named_function_parameters.h index a5313c72826..3a55845725c 100644 --- a/STL_Extension/include/CGAL/Named_function_parameters.h +++ b/STL_Extension/include/CGAL/Named_function_parameters.h @@ -359,6 +359,19 @@ const T& choose_parameter(const T& t) return t; } +// Version with three parameters for dynamic property maps +template +D choose_parameter(const internal_np::Param_not_found&, Dynamic_tag tag, PolygonMesh& pm) +{ + return get(tag, pm); +} + +template +const T& choose_parameter(const T& t, Dynamic_tag, PolygonMesh&) +{ + return t; +} + template struct is_default_parameter {