Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] unique pointer to cgal::Polyhedron_3 objects created in loop

Subject: CGAL users discussion list

List archive

[cgal-discuss] unique pointer to cgal::Polyhedron_3 objects created in loop


Chronological Thread 
  • From: Daniel Abler <>
  • To: <>
  • Subject: [cgal-discuss] unique pointer to cgal::Polyhedron_3 objects created in loop
  • Date: Wed, 27 May 2015 07:55:14 +0200
  • Organization: University of Bern

Dear List,

I would like to create a list of pointers to Polyhedron_3 objects (created in
a loop) for later meshing via Polyhedral_mesh_domain_3, as in the following
pseudocode:

struct K: public CGAL::Exact_predicates_inexact_constructions_kernel {};
typedef CGAL::Polyhedron_3<K> Polyhedron;
[...]

std::list<Polyhedron*> poly_pointer_list;

for (...)
{
[...]
Polyhedron cgalpoly =
FunctionThatCreatesCgalPolyhedronFromVTKPolyData;
poly_pointer_list.push_back(&cgalpoly);
}

The problem here is that &cgalpoly always points to the same address... I
suspect this has to do with the 'copy constructor' of Polyhedron_3 or my
'FunctionToCreateCgalPolyhedronFromVTKPolyData'.

How can I make sure that each cgalpoly created in the loop is kept in memory
and can be addressed by an unique pointer?

Many thanks,
Daniel





Archive powered by MHonArc 2.6.18.

Top of Page