Skip to content

Commit

Permalink
minor tweak with constexpr in CT_2
Browse files Browse the repository at this point in the history
  • Loading branch information
lrineau committed Apr 26, 2024
1 parent 8e1744f commit f219cdf
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions Triangulation_2/include/CGAL/Constrained_triangulation_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,9 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb, OutputIterator out)
// if the segment (or a subpart of the segment) that we are trying to constraint is already
// present in the triangulation and is already marked as constrained,
// then this is an intersection
if(std::is_same<Itag, No_constraint_intersection_tag>::value) {
if(dimension() == 1) {
if(fr->is_constrained(2))
throw Intersection_of_constraints_exception();
} else {
if(fr->is_constrained(i))
throw Intersection_of_constraints_exception();
if constexpr (std::is_same_v<Itag, No_constraint_intersection_tag>) {
if(fr->is_constrained(dimension() == 1 ? 2 : i)) {
throw Intersection_of_constraints_exception();
}
}

Expand Down Expand Up @@ -727,7 +723,7 @@ insert(const Point& a, Locate_type lt, Face_handle loc, int li)
}
if ( lt == Triangulation::EDGE && loc->is_constrained(li) )
{
if(std::is_same<Itag, No_constraint_intersection_tag>::value)
if constexpr (std::is_same_v<Itag, No_constraint_intersection_tag>)
throw Intersection_of_constraints_exception();

insert_in_constrained_edge = true;
Expand Down Expand Up @@ -840,13 +836,9 @@ insert_constraint(Vertex_handle vaa, Vertex_handle vbb)
// if the segment (or a subpart of the segment) that we are trying to constraint is already
// present in the triangulation and is already marked as constrained,
// then this is an intersection
if(std::is_same<Itag, No_constraint_intersection_tag>::value) {
if(dimension() == 1) {
if(fr->is_constrained(2))
throw Intersection_of_constraints_exception();
} else {
if(fr->is_constrained(i))
throw Intersection_of_constraints_exception();
if constexpr (std::is_same_v<Itag, No_constraint_intersection_tag>) {
if(fr->is_constrained(dimension() == 1 ? 2 : i)) {
throw Intersection_of_constraints_exception();
}
}

Expand Down

0 comments on commit f219cdf

Please sign in to comment.