Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Vertex_handle and "operator->"

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Vertex_handle and "operator->"


Chronological Thread 
  • From: "Eivind LM" <>
  • To:
  • Subject: Re: [cgal-discuss] Vertex_handle and "operator->"
  • Date: Tue, 07 Oct 2008 22:32:38 +0200

Hello Fernando,

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 '.'

Ok, I have neither had to deal with lists of iterators, nor used the upcoming version of C++, but I understand that this is more common than what I am used to.

Can I generally assume that all types that end with "_handle" in CGAL implements an "operator->"?

Yes.

Great! :)

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.
}
}

It all makes a lot of sense. Thanks for explaining.

If I had been able to find all this information by searching for "Vertex_handle" in the documentation index, then I couldn't have been happier. I guess I could have searched for "Handle" instead, then I would at least have found the link that Andreas just sent to the list. I'll try to be more creative next time I search the index :)

However, letting Vertex_handle have it's own page in the documentation makes sense to me, since it's such a basic part of the triangulation library.

Thanks again,
Eivind



Archive powered by MHonArc 2.6.16.

Top of Page