Subject: CGAL users discussion list
List archive
- From: Chris Theis <>
- To:
- Subject: [cgal-discuss] RE: Compilation problem with Polyhedron_corefinement
- Date: Wed, 27 Feb 2013 06:43:02 -0800 (PST)
Phillip,
Thanks a lot for the very quick and helpful answer! I really appreciate the fast responses of this list!
Cheers
Chris
From: Philipp Moeller-2 [via cgal-discuss]
[mailto:ml-node+[hidden email]]
Sent: 27 February 2013 14:05
To: Chris Theis
Subject: Re: Compilation problem with Polyhedron_corefinement
Chris Theis <[hidden email]> writes:
> Hello,
>
> I'm currently trying to implement some code applying boolean ops on
> polyhedra using the Polyhedron_corefinement functor. When I use the
> simplified code shown at the end of the posting it compiles fine on MSVC 11
> (VStudio 2012). Please note that it defines the polyhedra using the standard
> CGAL::Polyhedron_3 class. However, I need to extend this class and thus, I
> derive my own polyhedron class from CGAL::Polyhedron_3 and use it as a
> template parameter of the functor declaration:
>
> /// !!! Compiles using standard CGAL:Polyhedron_3 class
> typedef CGAL::Polyhedron_3<Kernel, CGAL::Polyhedron_items_3>
> CGPolyhedron;
> typedef CGAL::Polyhedron_corefinement<CGPolyhedron, Kernel>
> CGCorefinement;
>
>
> /// !!! Fails compiling
> typedef CMyDummyPoly<Kernel, CGAL::Polyhedron_items_3> CGPolyhedron;
> typedef CGAL::Polyhedron_corefinement<CGPolyhedron, Kernel>
> CGCorefinement;
>
>
> In the second case I end up in the Triangle_accessor_3 class with an
> "Error_bad_match" due to a missing template specialization.
>
> class Triangle_accessor_3 {
> // This class template should never be instantiated, but only its
> // specializations.
> typedef typename Polyhedron::Error_bad_match Error_bad_match;
> }
>
> I'm a bit lost here and would appreciate if somebody could give me a hint
> what could be the problem. Maybe I need to define some other template
> parameter somewhere, but I don't see where I go wrong. I have attached a
> full code example for illustration below.
Inheritance breaks specializations, because you won't match
base-classes. You can try to use the original specialization through
inheritance:
namespace CGAL {
template<typename Items, typename K>
class Triangle_accessor_3< CMyDummyPoly<Items, K>, K >
: public Triangle_accessor_3<
typename CMyDummyPoly<Items, K >::Base, K>
{};
}
This is extremely brittle and I really don't recommend it.
Otherwise you can just implement your own complete specialization of
Triangle_accessor_3 and provide the same methods the specialization for
Polyhedron provides, as the documentation [1] says.
The code for Triangle_accessor_3 could be tweaked to handle inheritance,
but this would mean we encourage inheritance from Polyhedron_3, which
isn't a good idea.
> ---------------------------------
>
> Example2: Does not compile
>
> ---------------------------------
> template <class kernel, class items>
> class CMyDummyPoly: public CGAL::Polyhedron_3<kernel,items>
> {
> public:
> CMyDummyPoly() {};
> virtual ~CMyDummyPoly() {};
This is dangerous. Keep in mind that you still won't be able to delete a pointer to
CGAL::Polyhedron_3 safely.
>
> };
>
>
Footnotes:
[1] http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Mesh_3_ref/Class_Triangle_accessor_3.html
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
If you reply to this email, your message will be added to the discussion below:
To unsubscribe from Compilation problem with Polyhedron_corefinement,
click here.
NAML
View this message in context: RE: Compilation problem with Polyhedron_corefinement
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Compilation problem with Polyhedron_corefinement, Chris Theis, 02/27/2013
- Re: [cgal-discuss] Compilation problem with Polyhedron_corefinement, Philipp Moeller, 02/27/2013
- [cgal-discuss] RE: Compilation problem with Polyhedron_corefinement, Chris Theis, 02/27/2013
- Re: [cgal-discuss] Compilation problem with Polyhedron_corefinement, Philipp Moeller, 02/27/2013
Archive powered by MHonArc 2.6.18.