Skip to Content.
Sympa Menu

cgal-discuss - const_iterator begin() in Compact_container

Subject: CGAL users discussion list

List archive

const_iterator begin() in Compact_container


Chronological Thread 
  • From: Samuel Hornus <>
  • To: cgal-discuss <>
  • Subject: const_iterator begin() in Compact_container
  • Date: Fri, 11 Jan 2008 17:29:45 +0100
  • Organization: INRIA


Hello,

I'm writing a Delaunay_triangulation_d.h that does not make use
of the Convex_hull_d.h
I have trouble in my |locate| function, which is a |const| member
function and (roughly) "contains" the following code:

Simplex_handle foo = simplices_.begin();

The |begin() const| method is called on the Compact_container<Simplex>,
because my method |locate| is (and should be) |const|.
But this method returns const_iterator as follows
[Compact_container.h, line 194]:

iterator begin() { return iterator(first_item, 0, 0); }
iterator end() { return iterator(last_item, 0); }
const_iterator begin() const { return const_iterator(first_item,0,0); }
const_iterator end() const { return const_iterator(last_item,0); }

...and of course the compiler complains that it can't convert a
const_iterator to an iterator.
Somehow, it seems wrong to me that the |begin() const| method returns
a const_iterator... since a convertor exists to |const|-ify a non-const
iterator.

So: Is the Compact_container.h wrong around line 194 ?
If not, then I don't really know what to do.
Thank you in advance,
Sam



Archive powered by MHonArc 2.6.16.

Top of Page