## CGAL::HalfedgeDS_default<Traits,HalfedgeDSItems,Alloc>

### Definition

template < | class Traits,
| class HalfedgeDSItems = CGAL::HalfedgeDS_items_2,
| class Alloc = CGAL_ALLOCATOR(int)>
class HalfedgeDS_default;

The class HalfedgeDS_default<Traits,HalfedgeDSItems,Alloc> is a model for the HalfedgeDS concept. The second template parameter HalfedgeDSItems has a default argument CGAL::HalfedgeDS_items_2. The third template parameter Alloc uses the CGAL default allocator as default setting. HalfedgeDS_default<Traits,HalfedgeDSItems,Alloc> is a list-based representation with bidirectional iterators that supports removal.

#include <CGAL/HalfedgeDS_default.h>

### Is Model for the Concept

HalfedgeDS<Traits,Items,Alloc>

### Types

typedef bidirectional_iterator_tag
| iterator_category;
typedef CGAL::Tag_true
| Supports_removal;

### See Also

CGAL::HalfedgeDS_list
CGAL::HalfedgeDS_vector
HalfedgeDSItems
CGAL::HalfedgeDS_items_2
CGAL::Polyhedron_3<Traits>
CGAL::HalfedgeDS_items_decorator<HDS>
CGAL::HalfedgeDS_decorator<HDS>
CGAL::HalfedgeDS_const_decorator<HDS>

### Implementation

Currently, HalfedgeDS_default<Traits,HalfedgeDSItems,Alloc> is derived from CGAL::HalfedgeDS_list<Traits>. The copy constructor and the assignment operator need O(n) time with n the total number of vertices, halfedges, and faces. The former suboptimal implementation with an O(n logn) runtime has been replaced with a faster implementation based on hashing for the pointer lookup.

Due to a workaround for the flag CGAL_CFG_NO_TMPL_IN_TMPL_PARAM, a halfedge data structure cannot be instantiated directly. For the HalfedgeDS_default<Traits,HalfedgeDSItems,Alloc> a macro simplifies its direct use. However, when using a halfedge data structure as an argument for another class template, the class template name HalfedgeDS_default must be used, not the macro.

    // The macro definition.
    #ifndef CGAL_CFG_NO_TMPL_IN_TMPL_PARAM
        #define CGAL_HALFEDGEDS_DEFAULT  ::CGAL::HalfedgeDS_default
    #else
        #define CGAL_HALFEDGEDS_DEFAULT  ::CGAL::HalfedgeDS_default::HDS
    #endif

    // The direct instantiation of the default HalfedgeDS given a Traits class.
    typedef CGAL_HALFEDGEDS_DEFAULT<Traits> HDS;