avoid constructing the Border_constraint_pmap when it's not needed

i.e. when it's given in the named parameters
This commit is contained in:
Jane Tournois 2016-03-31 14:29:17 +02:00
parent a8a8a669b8
commit e7c9bab5ae
1 changed files with 7 additions and 3 deletions

View File

@ -102,6 +102,7 @@ void isotropic_remeshing(const FaceRange& faces
{
typedef PolygonMesh PM;
typedef typename boost::graph_traits<PM>::vertex_descriptor vertex_descriptor;
typedef typename boost::graph_traits<PM>::edge_descriptor edge_descriptor;
using boost::choose_pmap;
using boost::get_param;
using boost::choose_param;
@ -125,9 +126,12 @@ void isotropic_remeshing(const FaceRange& faces
NamedParameters,
internal::Border_constraint_pmap<PM, FaceRange>//default
> ::type ECMap;
ECMap ecmap
= choose_param(get_param(np, edge_is_constrained),
internal::Border_constraint_pmap<PM, FaceRange>(pmesh, faces));
ECMap ecmap = (boost::is_same<ECMap, internal::Border_constraint_pmap<PM, FaceRange> >::value)
//avoid constructing the Border_constraint_pmap if it's not used
? choose_param(get_param(np, edge_is_constrained)
, internal::Border_constraint_pmap<PM, FaceRange>(pmesh, faces))
: choose_param(get_param(np, edge_is_constrained)
, internal::Border_constraint_pmap<PM, FaceRange>());
typedef typename boost::lookup_named_param_def <
CGAL::vertex_is_constrained_t,