Subject: CGAL users discussion list
List archive
- From: Fernando Cacciola <>
- To:
- Subject: Re: [cgal-discuss] Vertex_handle and "operator->"
- Date: Tue, 07 Oct 2008 15:04:39 -0300
Hello Eivind,
Speaking of Vertex_handle; am I the only one to mix up '.' and '->' with Vertex_handle?>
[snip]>
Using '*' and '->' at the same time on a variable (which is not a pointer type) looks "wrong" in my eyes>
How about:
std::list< Some_iterator > objects ;
Or in the upcoming version of C++
std::list< std::shared_ptr<someobj> > objects ;
?
With those you also need '->' instead of '.'
Can I generally assume that all types that end with "_handle" in CGAL implements an "operator->"?Yes.
Handles *refers* to other objects, just like iterators and pointers, so they provide indirect access via '->'
It is idiomatic to expect the left side of '->' to possibly refer to a non-existing object (say a past-the-end iterator or a null pointer), while that would be quite surprising for the left side of a '.'.
A default constructed handle, for instance, does not refer to any object at all:
void use_vertex ( Vertex_handle v )
{
Vertex_handle null ;
if ( v != null )
{
// 'v' corresponds to a valid vertex so go ahead and use it.
}
}
HTH
Fernando Cacciola
GeometryFactory
- [cgal-discuss] Vertex_handle and "operator->", Eivind LM, 10/07/2008
- Re: [cgal-discuss] Vertex_handle and "operator->", Fernando Cacciola, 10/07/2008
- Re: [cgal-discuss] Vertex_handle and "operator->", Eivind LM, 10/07/2008
- Re: [cgal-discuss] Vertex_handle and "operator->", Fernando Cacciola, 10/07/2008
Archive powered by MHonArc 2.6.16.