Subject: CGAL users discussion list
List archive
- From:
- To:
- Subject: Segmentation fault because of Inheritance?
- Date: Tue, 9 Oct 2007 17:02:15 +0200
I am working with the circular kernel
I build classes that inherit from circular_arc and circular_line;
these new classes do not allocate any memory (just implement some getters)
To make my problem clear I am posting my main header with some comments:
------------------------------------------------------------------ common.h
#ifndef COMMON_H
#define COMMON_H
#include <CGAL/Exact_circular_kernel_2.h>
#include <CGAL/Arr_circular_line_arc_traits.h>
#include <CGAL/Arr_extended_dcel.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_naive_point_location.h>
typedef double NT; // for debug
typedef CGAL::Cartesian<NT> Linear_k;
typedef CGAL::Algebraic_kernel_for_circles_2_2<NT> Algebraic_k;
typedef CGAL::Circular_kernel_2<Linear_k,Algebraic_k> Circular_k;
typedef CGAL::Orientation Orientation;
typedef Circular_k::Line_2 Line;
typedef Circular_k::Point_2 Pnt;
typedef Circular_k::Circular_arc_point_2 Point;
typedef Circular_k::Circle_2 Disk;
typedef Circular_k::Circular_arc_2 Circular_arc;
typedef Circular_k::Line_arc_2 Line_arc;
#include "Directed_arc.h" // class that inherits from Circular_arc
#include "Directed_line.h" // class that inherits form Line_arc
typedef boost::variant<Directed_arc, Directed_line> Arc;
typedef std::vector<Arc> ArcList;
typedef CGAL::Arr_circular_line_arc_traits
<Circular_k, Directed_arc, Directed_line> Arc_traits;
typedef Arc_traits::Curve_2 Curve;
typedef CGAL::Arr_extended_dcel
<Arc_traits, int, int, bool> Arc_dcel;
typedef CGAL::Arrangement_2<Arc_traits, Arc_dcel> Arrangement;
typedef CGAL::Arr_naive_point_location<Arrangement> Point_loc;
#endif
-----------------------------------------------------------------------------
Now everything goes fine in Compiletime, no warnings, nothing;
But when I try to add a curve of type variant<Directed_arc,Directed_line>
to an Arrangement, I get immediatly a Segmentation fault.
If I replace the Directed_arc and Directed_line above by Circular_arc and
Line_arc then everything works fine. Can't I use the inherited classes here?
Has anyone experienced a similar problem in perhaps another kernel?
Do I have to add further specifications to the Arr_extended_dcel?
Thank you in advance
mfg, Wolfgang
- Segmentation fault because of Inheritance?, waigner, 10/09/2007
Archive powered by MHonArc 2.6.16.