Subject: CGAL users discussion list
List archive
- From: Ben Supnik <>
- To:
- Subject: Re: [cgal-discuss] Inheritance of Polygon_2.
- Date: Sat, 03 Oct 2009 11:25:19 -0400
Hi Gilles,
gilles wrote:
Where this "bloody" type Traits is defined ???
Er, I think the problem is this: the CGAL class is a template, so it might do this:
template <class Traits>
class cgal_thingie {
public:
typedef typename Traits::Point Point;
};
What this is doing is "publishing" the Point type from the traits class that the cgal thingie is templated on into the cgal class itself.
Now...when you subclass, you don't have traits. You do this:
class my_subclass : public cgal_thingie<my_traits> {
public:
That means: you are making a SPECIFIC instantiation of the cgal class with some specific traits. So..."Traits" is NOT a template parameter for your class!
But...you want to publish "Point" not from the traits directly, but rather from your super-class, e.g.
typedef typename cgal_thingie<my_traits>::Point Point;
Or...
typedef cgal_thingie<my_traits> base;
typedef typename base::Point Point;
I do this second form to save typing. :-)
Re the use of typename...um...there is a method to the madness of typename, but you can also just use it and then remove it if GCC complains. :-)
(Basically any time you typedef and the source of the typedef cannot be understood without first "filling out" the template, you need typename to tell the compiler to suspend it's disbelief.)
cheers
ben
--
Scenery Home Page: http://scenery.x-plane.com/
Scenery blog: http://xplanescenery.blogspot.com/
Plugin SDK: http://www.xsquawkbox.net/xpsdk/
X-Plane Wiki: http://wiki.x-plane.com/
Scenery mailing list:
Developer mailing list:
- [cgal-discuss] Inheritance of Polygon_2., gilles.kneuss, 10/03/2009
- Re: [cgal-discuss] Inheritance of Polygon_2., Ben Supnik, 10/03/2009
- Re: [cgal-discuss] Inheritance of Polygon_2., gilles, 10/03/2009
- Re: [cgal-discuss] Inheritance of Polygon_2., gilles, 10/03/2009
- Re: [cgal-discuss] Inheritance of Polygon_2., Ben Supnik, 10/03/2009
- Re: [cgal-discuss] Inheritance of Polygon_2., Ben Supnik, 10/03/2009
- Re: [cgal-discuss] Inheritance of Polygon_2., Ben Supnik, 10/03/2009
Archive powered by MHonArc 2.6.16.