diff --git a/BGL/include/CGAL/boost/graph/Named_function_parameters.h b/BGL/include/CGAL/boost/graph/Named_function_parameters.h index f18f42fd94e..a9a9bd9b89b 100644 --- a/BGL/include/CGAL/boost/graph/Named_function_parameters.h +++ b/BGL/include/CGAL/boost/graph/Named_function_parameters.h @@ -210,9 +210,8 @@ get_parameter_reference_impl(Named_params_impl, Tag, N return np.v.get(); }; - template -typename Get_param, Query_tag>::type +typename Get_param, Query_tag>::reference get_parameter_reference_impl(Named_params_impl& np, Query_tag tag) { CGAL_static_assertion( (!boost::is_same::value) ); diff --git a/BGL/test/BGL/test_cgal_bgl_named_params.cpp b/BGL/test/BGL/test_cgal_bgl_named_params.cpp index 2abe9a28665..8a73d25df37 100644 --- a/BGL/test/BGL/test_cgal_bgl_named_params.cpp +++ b/BGL/test/BGL/test_cgal_bgl_named_params.cpp @@ -61,6 +61,12 @@ void test_references(const NamedParameters& np) Visitor_reference_type vis_ref = params::choose_parameter(params::get_parameter_reference(np, inp::visitor), default_value); CGAL_USE(vis_ref); + // std::reference_wrapper of const + typedef typename inp::Lookup_named_param_def::reference FIM_reference_type; + static_assert(std::is_same::value); + FIM_reference_type fim_ref = params::choose_parameter(params::get_parameter_reference(np, inp::face_index), default_value); + CGAL_USE(fim_ref); + // non-copyable typedef typename inp::Lookup_named_param_def::reference VPM_reference_type; static_assert(std::is_same::value); @@ -72,6 +78,12 @@ void test_references(const NamedParameters& np) static_assert(std::is_same&, VIM_reference_type>::value); VIM_reference_type vim_ref = params::choose_parameter(params::get_parameter_reference(np, inp::vertex_index), default_value); CGAL_USE(vim_ref); + + // default + typedef typename inp::Lookup_named_param_def::reference EIM_reference_type; + static_assert(std::is_same::value); + EIM_reference_type eim_ref = params::choose_parameter(params::get_parameter_reference(np, inp::edge_index), default_value); + assert(&eim_ref==&default_value); } int main() @@ -83,6 +95,9 @@ int main() test_references(params::visitor(std::ref(b)) .vertex_point_map(b) - .vertex_index_map(A<0>(0))); + .vertex_index_map(A<0>(0)) + .face_index_map(std::reference_wrapper(b)) + ); + return EXIT_SUCCESS; }