mirror of https://github.com/CGAL/cgal
more tests and a bugfix
This commit is contained in:
parent
0e730466ef
commit
b4cbfc7b5c
|
|
@ -210,9 +210,8 @@ get_parameter_reference_impl(Named_params_impl<std::reference_wrapper<T>, Tag, N
|
||||||
return np.v.get();
|
return np.v.get();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <typename T, typename Tag, typename Base, typename Query_tag>
|
template <typename T, typename Tag, typename Base, typename Query_tag>
|
||||||
typename Get_param<Named_params_impl<T, Tag, Base>, Query_tag>::type
|
typename Get_param<Named_params_impl<T, Tag, Base>, Query_tag>::reference
|
||||||
get_parameter_reference_impl(Named_params_impl<T, Tag, Base>& np, Query_tag tag)
|
get_parameter_reference_impl(Named_params_impl<T, Tag, Base>& np, Query_tag tag)
|
||||||
{
|
{
|
||||||
CGAL_static_assertion( (!boost::is_same<Query_tag, Tag>::value) );
|
CGAL_static_assertion( (!boost::is_same<Query_tag, Tag>::value) );
|
||||||
|
|
|
||||||
|
|
@ -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);
|
Visitor_reference_type vis_ref = params::choose_parameter(params::get_parameter_reference(np, inp::visitor), default_value);
|
||||||
CGAL_USE(vis_ref);
|
CGAL_USE(vis_ref);
|
||||||
|
|
||||||
|
// std::reference_wrapper of const
|
||||||
|
typedef typename inp::Lookup_named_param_def<inp::face_index_t, NamedParameters, Default_type>::reference FIM_reference_type;
|
||||||
|
static_assert(std::is_same<const B&, FIM_reference_type>::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
|
// non-copyable
|
||||||
typedef typename inp::Lookup_named_param_def<inp::vertex_point_t, NamedParameters, Default_type>::reference VPM_reference_type;
|
typedef typename inp::Lookup_named_param_def<inp::vertex_point_t, NamedParameters, Default_type>::reference VPM_reference_type;
|
||||||
static_assert(std::is_same<const B&, VPM_reference_type>::value);
|
static_assert(std::is_same<const B&, VPM_reference_type>::value);
|
||||||
|
|
@ -72,6 +78,12 @@ void test_references(const NamedParameters& np)
|
||||||
static_assert(std::is_same<A<0>&, VIM_reference_type>::value);
|
static_assert(std::is_same<A<0>&, VIM_reference_type>::value);
|
||||||
VIM_reference_type vim_ref = params::choose_parameter(params::get_parameter_reference(np, inp::vertex_index), default_value);
|
VIM_reference_type vim_ref = params::choose_parameter(params::get_parameter_reference(np, inp::vertex_index), default_value);
|
||||||
CGAL_USE(vim_ref);
|
CGAL_USE(vim_ref);
|
||||||
|
|
||||||
|
// default
|
||||||
|
typedef typename inp::Lookup_named_param_def<inp::edge_index_t, NamedParameters, Default_type>::reference EIM_reference_type;
|
||||||
|
static_assert(std::is_same<Default_type&, EIM_reference_type>::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()
|
int main()
|
||||||
|
|
@ -83,6 +95,9 @@ int main()
|
||||||
|
|
||||||
test_references(params::visitor(std::ref(b))
|
test_references(params::visitor(std::ref(b))
|
||||||
.vertex_point_map(b)
|
.vertex_point_map(b)
|
||||||
.vertex_index_map(A<0>(0)));
|
.vertex_index_map(A<0>(0))
|
||||||
|
.face_index_map(std::reference_wrapper<const B>(b))
|
||||||
|
);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue