Fix: use a pointer instead of a copy of Flat_orientation_d

Note: the previous commit fixing this problem (using
construct_flat_orientation_d_object()) was not compilable
This commit is contained in:
Clement Jamin 2014-04-01 16:01:21 +02:00
parent 3e7422dc75
commit 2258e7a810
2 changed files with 16 additions and 15 deletions

View File

@ -174,7 +174,7 @@ public:
Delaunay_triangulation(
int dim,
const std::pair<int, Flat_orientation_d> &preset_flat_orientation,
const std::pair<int, const Flat_orientation_d *> &preset_flat_orientation,
const Geom_traits k = Geom_traits())
: Base(dim, preset_flat_orientation, k)
{
@ -452,11 +452,13 @@ Delaunay_triangulation<DCTraits, TDS>
typedef typename Dark_triangulation::Facet Dark_facet;
typedef typename Dark_triangulation::Vertex_handle Dark_v_handle;
typedef typename Dark_triangulation::Full_cell_handle Dark_s_handle;
Dark_triangulation dark_side(maximal_dimension(),
Dark_triangulation dark_side(
maximal_dimension(),
flat_orientation_ ?
std::make_pair(current_dimension(), flat_orientation_.get())
: std::make_pair(std::numeric_limits<int>::max(),
geom_traits().construct_flat_orientation_d_object()) );
std::make_pair(current_dimension(), &flat_orientation_.get())
: std::make_pair<int, const Flat_orientation_d *>(std::numeric_limits<int>::max(), NULL) );
Dark_s_handle dark_s;
Dark_v_handle dark_v;
typedef std::map<Vertex_handle, Dark_v_handle> Vertex_map;

View File

@ -77,7 +77,10 @@ protected:
void reset_flat_orientation()
{
if (current_dimension() == preset_flat_orientation_.first)
flat_orientation_ = preset_flat_orientation_.second;
{
CGAL_assertion(preset_flat_orientation_.second != NULL);
flat_orientation_ = *preset_flat_orientation_.second;
}
else
flat_orientation_ = boost::none;
}
@ -146,7 +149,7 @@ protected: // DATA MEMBERS
Vertex_handle infinity_;
mutable std::vector<Oriented_side> orientations_;
mutable boost::optional<Flat_orientation_d> flat_orientation_;
std::pair<int, Flat_orientation_d> preset_flat_orientation_;
std::pair<int, const Flat_orientation_d *> preset_flat_orientation_;
// for stochastic walk in the locate() function:
mutable Random rng_;
#ifdef CGAL_TRIANGULATION_STATISTICS
@ -190,9 +193,7 @@ public:
, kernel_(k)
, infinity_()
, rng_((long)0)
, preset_flat_orientation_(
std::numeric_limits<int>::max(),
geom_traits().construct_flat_orientation_d_object())
, preset_flat_orientation_(std::numeric_limits<int>::max(), NULL)
#ifdef CGAL_TRIANGULATION_STATISTICS
,walk_size_(0)
#endif
@ -201,8 +202,8 @@ public:
}
Triangulation(
int dim,
const std::pair<int, Flat_orientation_d> &preset_flat_orientation,
int dim,
const std::pair<int, const Flat_orientation_d *> &preset_flat_orientation,
const Geom_traits k = Geom_traits())
: tds_(dim)
, kernel_(k)
@ -221,9 +222,7 @@ public:
, kernel_(t2.kernel_)
, infinity_()
, rng_(t2.rng_)
, preset_flat_orientation_(
std::numeric_limits<int>::max(),
geom_traits().construct_flat_orientation_d_object())
, preset_flat_orientation_(std::numeric_limits<int>::max(), NULL)
#ifdef CGAL_TRIANGULATION_STATISTICS
,walk_size_(t2.walk_size_)
#endif