From c6d0f902364a78596fd2e672f1c97eb951d05019 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 24 Feb 2023 11:18:13 +0100 Subject: [PATCH] differentiate between cref and ref in compatibility wrapper --- .../include/CGAL/Named_function_parameters.h | 21 +++++++++++++++++-- .../internal/parameters_interface.h | 12 +++++------ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/STL_Extension/include/CGAL/Named_function_parameters.h b/STL_Extension/include/CGAL/Named_function_parameters.h index 86424d05411..61974cf4bb9 100644 --- a/STL_Extension/include/CGAL/Named_function_parameters.h +++ b/STL_Extension/include/CGAL/Named_function_parameters.h @@ -51,12 +51,15 @@ enum all_default_t { all_default }; enum X { Y }; #define CGAL_add_named_parameter_with_compatibility(X, Y, Z) \ enum X { Y }; +#define CGAL_add_named_parameter_with_compatibility_cref_only(X, Y, Z) \ + enum X { Y }; #define CGAL_add_named_parameter_with_compatibility_ref_only(X, Y, Z) \ enum X { Y }; #define CGAL_add_extra_named_parameter_with_compatibility(X, Y, Z) #include #undef CGAL_add_named_parameter #undef CGAL_add_named_parameter_with_compatibility +#undef CGAL_add_named_parameter_with_compatibility_cref_only #undef CGAL_add_named_parameter_with_compatibility_ref_only #undef CGAL_add_extra_named_parameter_with_compatibility @@ -359,7 +362,7 @@ struct Named_function_parameters typedef Named_function_parameters Params;\ return Params(k, *this); \ } -#define CGAL_add_named_parameter_with_compatibility_ref_only(X, Y, Z) \ +#define CGAL_add_named_parameter_with_compatibility_cref_only(X, Y, Z) \ template \ Named_function_parameters, \ internal_np::X, self> \ @@ -369,6 +372,16 @@ struct Named_function_parameters internal_np::X, self> Params; \ return Params(std::cref(k), *this); \ } +#define CGAL_add_named_parameter_with_compatibility_ref_only(X, Y, Z) \ + template \ + Named_function_parameters, \ + internal_np::X, self> \ + Z(K& k) const \ + { \ + typedef Named_function_parameters, \ + internal_np::X, self> Params; \ + return Params(std::ref(k), *this); \ + } #define CGAL_add_extra_named_parameter_with_compatibility(X, Y, Z) \ template \ Named_function_parameters \ @@ -380,6 +393,7 @@ struct Named_function_parameters #include #undef CGAL_add_named_parameter #undef CGAL_add_named_parameter_with_compatibility +#undef CGAL_add_named_parameter_with_compatibility_cref_only #undef CGAL_add_named_parameter_with_compatibility_ref_only #undef CGAL_add_extra_named_parameter_with_compatibility @@ -475,7 +489,7 @@ struct Boost_parameter_compatibility_wrapper template Named_function_parameters, Tag> - operator=(K& p) const + operator=(std::reference_wrapper p) const { typedef Named_function_parameters, Tag> Params; return Params(std::ref(p)); @@ -494,6 +508,8 @@ struct Boost_parameter_compatibility_wrapper #define CGAL_add_named_parameter_with_compatibility(X, Y, Z) \ const Boost_parameter_compatibility_wrapper Z; +#define CGAL_add_named_parameter_with_compatibility_cref_only(X, Y, Z) \ + const Boost_parameter_compatibility_wrapper Z; #define CGAL_add_named_parameter_with_compatibility_ref_only(X, Y, Z) \ const Boost_parameter_compatibility_wrapper Z; #define CGAL_add_extra_named_parameter_with_compatibility(X, Y, Z) \ @@ -502,6 +518,7 @@ struct Boost_parameter_compatibility_wrapper #undef CGAL_add_named_parameter #undef CGAL_add_extra_named_parameter_with_compatibility #undef CGAL_add_named_parameter_with_compatibility +#undef CGAL_add_named_parameter_with_compatibility_cref_only #undef CGAL_add_named_parameter_with_compatibility_ref_only // Version with three parameters for dynamic property maps diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h index bfb2e4d475b..cf023cf5756 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h @@ -306,7 +306,7 @@ CGAL_add_named_parameter_with_compatibility(mesh_param_t, mesh_param, mesh_optio CGAL_add_named_parameter_with_compatibility(manifold_param_t, manifold_param, manifold_option) CGAL_add_named_parameter_with_compatibility(features_option_param_t,features_options_param,features_options) -CGAL_add_named_parameter_with_compatibility_ref_only(image_3_param_t, image_3_param, image) +CGAL_add_named_parameter_with_compatibility_cref_only(image_3_param_t, image_3_param, image) CGAL_add_named_parameter_with_compatibility(iso_value_param_t, iso_value_param, iso_value) CGAL_add_named_parameter_with_compatibility(image_subdomain_index_t, image_subdomain_index, image_values_to_subdomain_indices) CGAL_add_named_parameter_with_compatibility(voxel_value_t, voxel_value, value_outside) @@ -319,17 +319,17 @@ CGAL_add_named_parameter_with_compatibility(features_detector_param_t, features_ CGAL_add_named_parameter_with_compatibility(input_features_param_t, input_features_param, input_features) CGAL_add_named_parameter_with_compatibility(edge_size_param_t, edge_size_param, edge_size) -CGAL_add_named_parameter_with_compatibility_ref_only(edge_sizing_field_param_t, edge_sizing_field_param, edge_sizing_field) +CGAL_add_named_parameter_with_compatibility_cref_only(edge_sizing_field_param_t, edge_sizing_field_param, edge_sizing_field) CGAL_add_named_parameter_with_compatibility(facet_angle_param_t, facet_angle_param, facet_angle) CGAL_add_named_parameter_with_compatibility(facet_size_param_t, facet_size_param, facet_size) -CGAL_add_named_parameter_with_compatibility_ref_only(facet_sizing_field_param_t, facet_sizing_field_param, facet_sizing_field) -CGAL_add_named_parameter_with_compatibility_ref_only(facet_distance_param_t, facet_distance_param, facet_distance) +CGAL_add_named_parameter_with_compatibility_cref_only(facet_sizing_field_param_t, facet_sizing_field_param, facet_sizing_field) +CGAL_add_named_parameter_with_compatibility_cref_only(facet_distance_param_t, facet_distance_param, facet_distance) CGAL_add_named_parameter_with_compatibility(facet_topology_param_t, facet_topology_param, facet_topology) CGAL_add_named_parameter_with_compatibility(cell_radius_edge_param_t, cell_radius_edge_param, cell_radius_edge) CGAL_add_named_parameter_with_compatibility(cell_radius_edge_ratio_param_t, cell_radius_edge_ratio_param, cell_radius_edge_ratio) CGAL_add_named_parameter_with_compatibility(cell_size_param_t, cell_size_param, cell_size) -CGAL_add_named_parameter_with_compatibility_ref_only(cell_sizing_field_param_t, cell_sizing_field_param, cell_sizing_field) -CGAL_add_named_parameter_with_compatibility_ref_only(sizing_field_param_t, sizing_field_param, sizing_field) +CGAL_add_named_parameter_with_compatibility_cref_only(cell_sizing_field_param_t, cell_sizing_field_param, cell_sizing_field) +CGAL_add_named_parameter_with_compatibility_cref_only(sizing_field_param_t, sizing_field_param, sizing_field) CGAL_add_named_parameter_with_compatibility(function_param_t, function_param, function) CGAL_add_named_parameter_with_compatibility(bounding_object_param_t, bounding_object_param, bounding_object)