Skip to content

Commit

Permalink
remove CGAL_CXX11 macro usage
Browse files Browse the repository at this point in the history
  • Loading branch information
sloriot committed Jul 8, 2019
1 parent c5566d3 commit c0edb5e
Show file tree
Hide file tree
Showing 48 changed files with 29 additions and 824 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1435,13 +1435,9 @@ compute_event_x_coordinates_with_event_indices() const {
CGAL_ACK_DEBUG_PRINT << " one curve event" << std::endl;
#endif
*/
#if CGAL_CXX11
// Fix a warning by using `emplace_back()` instead of
// copying a non-initialized `optional
this->ptr()->event_slices.emplace_back();
#else
this->ptr()->event_slices.push_back(Lazy_status_line_CPA_1());
#endif
switch(*(one_curve_it++)) {
case(CGAL::internal::ROOT_OF_FIRST_SET): {
event_indices.push_back(Event_indices(-1,f_count,-1));
Expand All @@ -1468,11 +1464,7 @@ compute_event_x_coordinates_with_event_indices() const {
CGAL_ACK_DEBUG_PRINT << " two curve event" << std::endl;
#endif
*/
#if CGAL_CXX11
this->ptr()->event_slices.emplace_back();
#else
this->ptr()->event_slices.push_back(Lazy_status_line_CPA_1());
#endif

event_indices.push_back
(Event_indices(inter_count,-1,-1));
Expand All @@ -1486,12 +1478,7 @@ compute_event_x_coordinates_with_event_indices() const {
<< std::endl;
#endif
*/
#if CGAL_CXX11
this->ptr()->event_slices.emplace_back();
#else
this->ptr()->event_slices.push_back(Lazy_status_line_CPA_1());
#endif


switch(*(one_curve_it++)) {
case(CGAL::internal::ROOT_OF_FIRST_SET): {
Expand Down
75 changes: 0 additions & 75 deletions Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -908,40 +908,13 @@ class Arr_dcel_base {
typedef In_place_list<Inner_ccb, false> Inner_ccb_list;
typedef In_place_list<Isolated_vertex, false> Iso_vert_list;

#ifdef CGAL_CXX11
typedef std::allocator_traits<Allocator> Allocator_traits;
typedef typename Allocator_traits::template rebind_alloc<Vertex> Vertex_allocator;
typedef typename Allocator_traits::template rebind_alloc<Halfedge> Halfedge_allocator;
typedef typename Allocator_traits::template rebind_alloc<Face> Face_allocator;
typedef typename Allocator_traits::template rebind_alloc<Outer_ccb> Outer_ccb_allocator;
typedef typename Allocator_traits::template rebind_alloc<Inner_ccb> Inner_ccb_allocator;
typedef typename Allocator_traits::template rebind_alloc<Isolated_vertex> Iso_vert_allocator;
#else // not CGAL_CXX11
// Vertex allocator.
typedef typename Allocator::template rebind<Vertex> Vertex_alloc_rebind;
typedef typename Vertex_alloc_rebind::other Vertex_allocator;

// Halfedge allocator.
typedef typename Allocator::template rebind<Halfedge> Halfedge_alloc_rebind;
typedef typename Halfedge_alloc_rebind::other Halfedge_allocator;

// Face allocator.
typedef typename Allocator::template rebind<Face> Face_alloc_rebind;
typedef typename Face_alloc_rebind::other Face_allocator;

// Outer CCB allocator.
typedef typename Allocator::template rebind<Outer_ccb> Out_ccb_alloc_rebind;
typedef typename Out_ccb_alloc_rebind::other Outer_ccb_allocator;

// Inner CCB allocator.
typedef typename Allocator::template rebind<Inner_ccb> In_ccb_alloc_rebind;
typedef typename In_ccb_alloc_rebind::other Inner_ccb_allocator;

// Isolated vertex allocator.
typedef typename Allocator::template rebind<Isolated_vertex>
Iso_vert_alloc_rebind;
typedef typename Iso_vert_alloc_rebind::other Iso_vert_allocator;
#endif // not CGAL_CXX11

public:
typedef typename Halfedge_list::size_type Size;
Expand Down Expand Up @@ -1089,11 +1062,7 @@ class Arr_dcel_base {
Vertex* new_vertex()
{
Vertex* v = vertex_alloc.allocate(1);
#ifdef CGAL_CXX11
std::allocator_traits<Vertex_allocator>::construct(vertex_alloc,v);
#else
vertex_alloc.construct(v, Vertex());
#endif
vertices.push_back(*v);
return v;
}
Expand All @@ -1116,11 +1085,7 @@ class Arr_dcel_base {
Face* new_face()
{
Face* f = face_alloc.allocate(1);
#ifdef CGAL_CXX11
std::allocator_traits<Face_allocator>::construct(face_alloc, f);
#else
face_alloc.construct(f, Face());
#endif
faces.push_back (*f);
return(f);
}
Expand All @@ -1129,11 +1094,7 @@ class Arr_dcel_base {
Outer_ccb* new_outer_ccb()
{
Outer_ccb* oc = out_ccb_alloc.allocate(1);
#ifdef CGAL_CXX11
std::allocator_traits<Outer_ccb_allocator>::construct(out_ccb_alloc, oc);
#else
out_ccb_alloc.construct(oc, Outer_ccb());
#endif
out_ccbs.push_back(*oc);
return (oc);
}
Expand All @@ -1142,11 +1103,7 @@ class Arr_dcel_base {
Inner_ccb* new_inner_ccb()
{
Inner_ccb* ic = in_ccb_alloc.allocate(1);
#ifdef CGAL_CXX11
std::allocator_traits<Inner_ccb_allocator>::construct(in_ccb_alloc, ic);
#else
in_ccb_alloc.construct(ic, Inner_ccb());
#endif
in_ccbs.push_back(*ic);
return (ic);
}
Expand All @@ -1155,11 +1112,7 @@ class Arr_dcel_base {
Isolated_vertex* new_isolated_vertex()
{
Isolated_vertex* iv = iso_vert_alloc.allocate(1);
#ifdef CGAL_CXX11
std::allocator_traits<Iso_vert_allocator>::construct(iso_vert_alloc, iv);
#else
iso_vert_alloc.construct(iv, Isolated_vertex());
#endif
iso_verts.push_back(*iv);
return (iv);
}
Expand All @@ -1171,11 +1124,7 @@ class Arr_dcel_base {
void delete_vertex(Vertex* v)
{
vertices.erase(v);
#ifdef CGAL_CXX11
std::allocator_traits<Vertex_allocator>::destroy(vertex_alloc, v);
#else
vertex_alloc.destroy(v);
#endif
vertex_alloc.deallocate(v,1);
}

Expand All @@ -1191,47 +1140,31 @@ class Arr_dcel_base {
void delete_face(Face* f)
{
faces.erase(f);
#ifdef CGAL_CXX11
std::allocator_traits<Face_allocator>::destroy(face_alloc, f);
#else
face_alloc.destroy(f);
#endif
face_alloc.deallocate(f, 1);
}

/*! Delete an existing outer CCB. */
void delete_outer_ccb(Outer_ccb* oc)
{
out_ccbs.erase(oc);
#ifdef CGAL_CXX11
std::allocator_traits<Outer_ccb_allocator>::destroy(out_ccb_alloc, oc);
#else
out_ccb_alloc.destroy(oc);
#endif
out_ccb_alloc.deallocate(oc, 1);
}

/*! Delete an existing inner CCB. */
void delete_inner_ccb(Inner_ccb* ic)
{
in_ccbs.erase(ic);
#ifdef CGAL_CXX11
std::allocator_traits<Inner_ccb_allocator>::destroy(in_ccb_alloc, ic);
#else
in_ccb_alloc.destroy(ic);
#endif
in_ccb_alloc.deallocate(ic, 1);
}

/*! Delete an existing isolated vertex. */
void delete_isolated_vertex(Isolated_vertex* iv)
{
iso_verts.erase(iv);
#ifdef CGAL_CXX11
std::allocator_traits<Iso_vert_allocator>::destroy(iso_vert_alloc, iv);
#else
iso_vert_alloc.destroy(iv);
#endif
iso_vert_alloc.deallocate(iv, 1);
}

Expand Down Expand Up @@ -1492,11 +1425,7 @@ class Arr_dcel_base {
Halfedge* _new_halfedge()
{
Halfedge* h = halfedge_alloc.allocate(1);
#ifdef CGAL_CXX11
std::allocator_traits<Halfedge_allocator>::construct(halfedge_alloc, h);
#else
halfedge_alloc.construct(h, Halfedge());
#endif
halfedges.push_back(*h);
return (h);
}
Expand All @@ -1505,11 +1434,7 @@ class Arr_dcel_base {
void _delete_halfedge(Halfedge* h)
{
halfedges.erase(h);
#ifdef CGAL_CXX11
std::allocator_traits<Halfedge_allocator>::destroy(halfedge_alloc,h);
#else
halfedge_alloc.destroy(h);
#endif
halfedge_alloc.deallocate(h, 1);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ assign(const Self& arr)
dup_c = m_curves_alloc.allocate (1);

p_cv = &(*ocit);
#ifdef CGAL_CXX11
std::allocator_traits<Curves_alloc>::construct(m_curves_alloc, dup_c, *p_cv);
#else
m_curves_alloc.construct(dup_c, *p_cv);
#endif
m_curves.push_back (*dup_c);

// Assign a map entry.
Expand Down Expand Up @@ -185,11 +181,7 @@ void Arrangement_on_surface_with_history_2<GeomTr,TopTr>::clear ()
++cit;

m_curves.erase (p_cv);
#ifdef CGAL_CXX11
std::allocator_traits<Curves_alloc>::destroy(m_curves_alloc,p_cv);
#else
m_curves_alloc.destroy (p_cv);
#endif
m_curves_alloc.deallocate (p_cv, 1);
}
m_curves.destroy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,8 @@ class Arr_with_history_accessor
// and store it in the curves' list.
typename Arrangement_with_history_2::Curve_halfedges *p_cv =
p_arr->m_curves_alloc.allocate (1);
#ifdef CGAL_CXX11
typedef decltype(p_arr->m_curves_alloc) M_Curves_alloc;
std::allocator_traits<M_Curves_alloc>::construct(p_arr->m_curves_alloc, p_cv, cv);
#else
p_arr->m_curves_alloc.construct (p_cv, cv);
#endif
p_arr->m_curves.push_back (*p_cv);

// Return a handle to the inserted curve (the last in the list).
Expand Down
16 changes: 0 additions & 16 deletions Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -1556,47 +1556,31 @@ class Arrangement_on_surface_2 {
Point_2*_new_point(const Point_2& pt)
{
Point_2* p_pt = m_points_alloc.allocate(1);
#ifdef CGAL_CXX11
std::allocator_traits<Points_alloc>::construct(m_points_alloc, p_pt, pt);
#else
m_points_alloc.construct(p_pt, pt);
#endif
return (p_pt);
}

/*! De-allocate a point. */
void _delete_point(Point_2& pt)
{
Point_2* p_pt = &pt;
#ifdef CGAL_CXX11
std::allocator_traits<Points_alloc>::destroy(m_points_alloc, p_pt);
#else
m_points_alloc.destroy(p_pt);
#endif
m_points_alloc.deallocate(p_pt, 1);
}

/*! Allocate a new curve. */
X_monotone_curve_2* _new_curve(const X_monotone_curve_2& cv)
{
X_monotone_curve_2* p_cv = m_curves_alloc.allocate(1);
#ifdef CGAL_CXX11
std::allocator_traits<Curves_alloc>::construct(m_curves_alloc, p_cv, cv);
#else
m_curves_alloc.construct(p_cv, cv);
#endif
return (p_cv);
}

/*! De-allocate a curve. */
void _delete_curve(X_monotone_curve_2& cv)
{
X_monotone_curve_2* p_cv = &cv;
#ifdef CGAL_CXX11
std::allocator_traits<Curves_alloc>::destroy(m_curves_alloc, p_cv);
#else
m_curves_alloc.destroy(p_cv);
#endif
m_curves_alloc.deallocate(p_cv, 1);
}
//@}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,11 +623,7 @@ class Arrangement_on_surface_with_history_2 :
// Allocate an extended curve (with an initially empty set of edges)
// and store it in the curves' list.
Curve_halfedges *p_cv = m_curves_alloc.allocate (1);
#ifdef CGAL_CXX11
std::allocator_traits<Curves_alloc>::construct(m_curves_alloc, p_cv, cv);
#else
m_curves_alloc.construct (p_cv, cv);
#endif
m_curves.push_back (*p_cv);

// Create a data-traits Curve_2 object, which is comprised of cv and
Expand Down Expand Up @@ -656,11 +652,7 @@ class Arrangement_on_surface_with_history_2 :
// and store it in the curves' list.
Curve_halfedges *p_cv = m_curves_alloc.allocate (1);

#ifdef CGAL_CXX11
std::allocator_traits<Curves_alloc>::construct(m_curves_alloc, p_cv, cv);
#else
m_curves_alloc.construct (p_cv, cv);
#endif
m_curves.push_back (*p_cv);

// Create a data-traits Curve_2 object, which is comprised of cv and
Expand Down Expand Up @@ -691,11 +683,7 @@ class Arrangement_on_surface_with_history_2 :
while (begin != end) {
Curve_halfedges *p_cv = m_curves_alloc.allocate (1);

#ifdef CGAL_CXX11
std::allocator_traits<Curves_alloc>::construct(m_curves_alloc, p_cv, *begin);
#else
m_curves_alloc.construct (p_cv, *begin);
#endif
m_curves.push_back (*p_cv);

data_curves.push_back (Data_curve_2 (*begin, p_cv));
Expand Down Expand Up @@ -744,11 +732,7 @@ class Arrangement_on_surface_with_history_2 :
// Remove the extended curve object from the list and de-allocate it.
m_curves.erase (p_cv);

#ifdef CGAL_CXX11
std::allocator_traits<Curves_alloc>::destroy(m_curves_alloc, p_cv);
#else
m_curves_alloc.destroy (p_cv);
#endif
m_curves_alloc.deallocate (p_cv, 1);

return (n_removed);
Expand Down Expand Up @@ -811,11 +795,7 @@ class Arrangement_on_surface_with_history_2 :

p_cv = &(*ocit1);

#ifdef CGAL_CXX11
std::allocator_traits<Curves_alloc>::construct(m_curves_alloc, dup_c, *p_cv);
#else
m_curves_alloc.construct (dup_c, *p_cv);
#endif
m_curves.push_back (*dup_c);

// Assign a map entry.
Expand All @@ -830,11 +810,7 @@ class Arrangement_on_surface_with_history_2 :
dup_c = m_curves_alloc.allocate (1);

p_cv = &(*ocit2);
#ifdef CGAL_CXX11
std::allocator_traits<Curves_alloc>::construct(m_curves_alloc, dup_c, *p_cv);
#else
m_curves_alloc.construct (dup_c, *p_cv);
#endif
m_curves.push_back (*dup_c);

// Assign a map entry.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,9 @@ class Gps_agg_op_surface_sweep_2 : public Ss2::Surface_sweep_2<Visitor_> {
}

// Create the subcurve object.
#ifdef CGAL_CXX11
typedef decltype(this->m_subCurveAlloc) Subcurve_alloc;
std::allocator_traits<Subcurve_alloc>::construct(this->m_subCurveAlloc, this->m_subCurves + index,
this->m_masterSubcurve);
#else
this->m_subCurveAlloc.construct(this->m_subCurves + index,
this->m_masterSubcurve);
#endif
(this->m_subCurves + index)->init(*iter);
(this->m_subCurves + index)->set_left_event(e_left);
(this->m_subCurves + index)->set_right_event(e_right);
Expand Down
Loading

0 comments on commit c0edb5e

Please sign in to comment.