1 // Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
2 // All rights reserved.
3 //
4 // This file is part of CGAL (www.cgal.org)
5 //
6 // $URL: https://github.com/CGAL/cgal/blob/v5.3/Combinatorial_map/include/CGAL/Dart_iterators.h $
7 // $Id: Dart_iterators.h 0779373 2020-03-26T13:31:46+01:00 Sébastien Loriot
8 // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
9 //
10 // Author(s)     : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
11 //
12 #ifndef CGAL_DART_ITERATORS_HH
13 #define CGAL_DART_ITERATORS_HH 1
14 
15 #include <CGAL/Combinatorial_map_iterators_base.h>
16 
17 namespace CGAL {
18 
19   /** @file Dart_iterators.h
20    * Definition of dart iterators. There are 9 iterators:
21    * - CMap_dart_iterator_basic_of_orbit<Map,Beta...>
22    * - CMap_dart_iterator_basic_of_cell<Map,i,d>
23    * - CMap_dart_iterator_basic_of_all
24    * - CMap_dart_iterator_basic_of_involution<Map,i,d>
25    * - CMap_dart_iterator_basic_of_involution_inv<Map,i,d>
26    * - CMap_dart_iterator_of_orbit<Map,Beta...>
27    * - CMap_dart_iterator_of_cell<Map,i,d>
28    * - CMap_dart_iterator_of_involution<Map,i,d>
29    * - CMap_dart_iterator_of_involution_inv<Map,i,d>
30    * but many specializations to optimize specific cases.
31    *
32    */
33   //****************************************************************************
34   //**********************BASIC ITERATORS***************************************
35   //****************************************************************************
36   /* Class CMap_dart_iterator_basic_of_orbit<Map, Beta...>: to iterate
37    * on the darts of the orbit <Beta...>
38    */
39   template<typename Map,bool Const,int... Beta>
40   class CMap_dart_iterator_basic_of_orbit_generic;
41   //****************************************************************************
42   // Case when Beta... is empty: iterator of self
43   template <typename Map_,bool Const>
44   class CMap_dart_iterator_basic_of_orbit_generic<Map_,Const>:
45     public CMap_dart_iterator<Map_,Const>
46   {
47   public:
48     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const> Self;
49     typedef CMap_dart_iterator<Map_,Const> Base;
50 
51     typedef typename Base::Dart_handle Dart_handle;
52     typedef typename Base::Map Map;
53     typedef typename Map::size_type size_type;
54 
55     typedef Tag_false Use_mark;
56 
57   public:
58     /// Main constructor.
CMap_dart_iterator_basic_of_orbit_generic(Map & amap,Dart_handle adart)59     CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart):
60       Base(amap, adart)
61     {}
62 
63     /// Main constructor.
CMap_dart_iterator_basic_of_orbit_generic(Map & amap,Dart_handle adart,size_type)64     CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart,
65                                               size_type /*amark*/):
66       Base(amap, adart)
67     {}
68 
69     /// Prefix ++ operator.
70     Self& operator++()
71     {
72       CGAL_assertion(this->cont());
73       this->set_current_dart(this->mmap->null_handle);
74       this->mprev_op = OP_END;
75       return *this;
76     }
77 
78     /// Postfix ++ operator.
79     Self operator++(int)
80     { Self res=*this; operator ++(); return res; }
81   };
82   //****************************************************************************
83   /* Class CMap_dart_iterator_basic_of_orbit<Map,0>: iterate onto orbit <beta0>.
84    * Begin by turning around the facet with beta0, then turn if
85    * necessary in the second direction by using beta1.
86    */
87   template <typename Map_,bool Const>
88   class CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,0>:
89     public CMap_dart_iterator<Map_,Const>
90   {
91   public:
92     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,0> Self;
93     typedef CMap_dart_iterator<Map_,Const> Base;
94 
95     typedef typename Base::Dart_handle Dart_handle;
96     typedef typename Base::Map Map;
97     typedef typename Map::size_type size_type;
98 
99     typedef Tag_false Use_mark;
100 
101   public:
102     /// Main constructor.
CMap_dart_iterator_basic_of_orbit_generic(Map & amap,Dart_handle adart)103     CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart):
104       Base(amap, adart),
105       mfirst_dir(true)
106     {}
107 
108     /// Main constructor.
CMap_dart_iterator_basic_of_orbit_generic(Map & amap,Dart_handle adart,size_type)109     CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart,
110                                               size_type /*amark*/):
111       Base(amap, adart),
112       mfirst_dir(true)
113     {}
114 
115     /// Assignment operator.
116     Self& operator= (const Self & aiterator)
117     {
118       if (this != &aiterator)
119       {
120         Base::operator=(aiterator);
121         mfirst_dir = aiterator.mfirst_dir;
122       }
123       return *this;
124     }
125 
126     /// Rewind of the iterator to its beginning.
rewind()127     void rewind()
128     {
129       Base::rewind();
130       mfirst_dir = true;
131     }
132 
133     /// Prefix ++ operator.
134     Self& operator++()
135     {
136       CGAL_assertion(this->cont());
137 
138       if (mfirst_dir && this->mmap->is_free(*this, 0))
139       {
140         this->set_current_dart(this->mfirst_dart);
141         mfirst_dir = false;
142         this->mprev_op = OP_JUMP;
143       }
144       else
145       {
146         this->mprev_op = OP_BETAI;
147       }
148 
149       if (mfirst_dir)
150       {
151         CGAL_assertion(!this->mmap->is_free(*this, 0));
152         this->set_current_dart(this->mmap->beta(*this, 0));
153 
154         if ((*this)==this->mfirst_dart)
155         {
156           this->set_current_dart(this->mmap->null_handle);
157           this->mprev_op = OP_END;
158         }
159       }
160       else
161       {
162         if (this->mmap->is_free(*this, 1))
163         {
164           this->set_current_dart(this->mmap->null_handle);
165           this->mprev_op = OP_END;
166         }
167         else
168         {
169           this->set_current_dart(this->mmap->beta(*this, 1));
170           this->mprev_op = OP_BETAI_INV;
171         }
172       }
173       return *this;
174     }
175 
176     /// Postfix ++ operator.
177     Self operator++(int)
178     { Self res=*this; operator ++(); return res; }
179 
180   protected:
181     /// Boolean: true iff we turn in the first direction (i.e. using beta0).
182     bool mfirst_dir;
183   };
184   //****************************************************************************
185   /* Class CMap_dart_iterator_basic_of_orbit<Map,1>: iterate onto orbit <beta1>.
186    * Begin by turning around the facet with beta1, then turn if
187    * necessary in the second direction by using beta0.
188    */
189   template <typename Map_,bool Const>
190   class CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1>:
191     public CMap_dart_iterator<Map_,Const>
192   {
193   public:
194     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1> Self;
195     typedef CMap_dart_iterator<Map_,Const> Base;
196 
197     typedef typename Base::Dart_handle Dart_handle;
198     typedef typename Base::Map Map;
199     typedef typename Map::size_type size_type;
200 
201     typedef Tag_false Use_mark;
202 
203   public:
204     /// Main constructor.
CMap_dart_iterator_basic_of_orbit_generic(Map & amap,Dart_handle adart)205     CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart):
206       Base(amap, adart),
207       mfirst_dir(true)
208     {}
209 
210     /// Main constructor.
CMap_dart_iterator_basic_of_orbit_generic(Map & amap,Dart_handle adart,size_type)211     CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart,
212                                               size_type /*amark*/):
213       Base(amap, adart),
214       mfirst_dir(true)
215     {}
216 
217     /// Rewind of the iterator to its beginning.
rewind()218     void rewind()
219     {
220       Base::rewind();
221       mfirst_dir = true;
222     }
223 
224     /// Prefix ++ operator.
225     Self& operator++()
226     {
227       CGAL_assertion(this->cont());
228 
229       if (mfirst_dir && this->mmap->is_free(*this, 1))
230       {
231         this->set_current_dart(this->mfirst_dart);
232         mfirst_dir = false;
233         this->mprev_op = OP_JUMP;
234       }
235       else
236       {
237         this->mprev_op = OP_BETAI;
238       }
239 
240       if (mfirst_dir)
241       {
242         CGAL_assertion(!this->mmap->is_free(*this, 1));
243         this->set_current_dart(this->mmap->beta(*this, 1));
244 
245         if ((*this)==this->mfirst_dart)
246         {
247           this->set_current_dart(this->mmap->null_handle);
248           this->mprev_op = OP_END;
249         }
250       }
251       else
252       {
253         if (this->mmap->is_free(*this, 0))
254         {
255           this->set_current_dart(this->mmap->null_handle);
256           this->mprev_op = OP_END;
257         }
258         else
259         {
260           this->set_current_dart(this->mmap->beta(*this, 0));
261           this->mprev_op = OP_BETAI_INV;
262         }
263       }
264       return *this;
265     }
266 
267     /// Postfix ++ operator.
268     Self operator++(int)
269     { Self res=*this; operator ++(); return res; }
270 
271   protected:
272     /// Boolean: true iff we turn in the first direction (i.e. using beta0).
273     bool mfirst_dir;
274   };
275   //****************************************************************************
276   /* Class CMap_dart_iterator_basic_of_orbit<Bi>: to iterate
277    * on the darts of the orbit <Bi> (2<=Bi<=dimension)
278    * (not for beta0 and beta1 which are special cases).
279    */
280   template <typename Map_,bool Const,int Bi>
281   class CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,Bi>:
282     public CMap_dart_iterator<Map_,Const>
283   {
284   public:
285     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,Bi> Self;
286     typedef CMap_dart_iterator<Map_,Const> Base;
287 
288     typedef typename Base::Dart_handle Dart_handle;
289     typedef typename Base::Map Map;
290     typedef typename Map::size_type size_type;
291 
292     typedef Tag_false Use_mark;
293 
294   public:
295     /// Main constructor.
CMap_dart_iterator_basic_of_orbit_generic(Map & amap,Dart_handle adart)296     CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart):
297       Base(amap, adart)
298     { CGAL_static_assertion( Bi>=2 && Bi<=Map::dimension ); }
299 
300     /// Main constructor.
CMap_dart_iterator_basic_of_orbit_generic(Map & amap,Dart_handle adart,size_type)301     CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart,
302                                               size_type /*amark*/):
303       Base(amap, adart)
304     { CGAL_static_assertion( Bi>=2 && Bi<=Map::dimension ); }
305 
306     /// Prefix ++ operator.
307     Self& operator++()
308     {
309       CGAL_assertion(this->cont());
310       if ((*this)!=this->mfirst_dart || this->mmap->is_free(*this, Bi))
311       {
312         this->set_current_dart(this->mmap->null_handle);
313         this->mprev_op = OP_END;
314       }
315       else
316       {
317         this->set_current_dart(this->mmap->beta(*this, Bi));
318         this->mprev_op = OP_BETAI;
319       }
320       return *this;
321     }
322 
323     /// Postfix ++ operator.
324     Self operator++(int)
325     { Self res=*this; operator ++(); return res; }
326   };
327   //****************************************************************************
328   /* Class CMap_dart_iterator_basic_of_two_beta<Bi,delta>: to iterate
329    * on the darts of the orbit <Bi,Bi+delta>: Bi<Bi+delta<=dimension.
330    * This general case if for Bi>1 and delta>1.
331    * Basic classes do not guaranty correct marks (i.e. do not unmark darts in
332    * the destructor, possible problem with the rewind). If you are not sure,
333    * use CMap_dart_iterator_basic_of_two_beta.
334    */
335   template <typename Map_,bool Const,int Bi,unsigned int delta>
336   class CMap_dart_iterator_basic_of_two_beta :
337     public CMap_dart_iterator<Map_,Const>
338   {
339   public:
340     typedef CMap_dart_iterator_basic_of_two_beta<Map_,Const,Bi,delta> Self;
341     typedef CMap_dart_iterator<Map_,Const> Base;
342 
343     typedef typename Base::Dart_handle Dart_handle;
344     typedef typename Base::Map Map;
345     typedef typename Map::size_type size_type;
346 
347     typedef Tag_false Use_mark;
348 
349     CGAL_static_assertion( Bi>1 && delta>1 && Bi+delta<=Map::dimension );
350 
351   public:
352     /// Main constructor.
CMap_dart_iterator_basic_of_two_beta(Map & amap,Dart_handle adart)353     CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart):
354       Base(amap, adart),
355       mcurdart(0)
356     {}
357 
358     /// Main constructor.
CMap_dart_iterator_basic_of_two_beta(Map & amap,Dart_handle adart,size_type)359     CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart,
360                                          size_type /*amark*/):
361       Base(amap, adart),
362       mcurdart(0)
363     {}
364 
365     /// Rewind of the iterator to its beginning.
rewind()366     void rewind()
367     {
368       Base::rewind();
369       mcurdart=0;
370     }
371 
372     /// Prefix ++ operator.
373     Self& operator++()
374     {
375       CGAL_assertion(this->cont());
376 
377       if (mcurdart==0)
378       {
379         if (!this->mmap->is_free(*this, Bi))
380         {
381           this->set_current_dart(this->mmap->beta(*this, Bi));
382           this->mprev_op = OP_BETAI;
383           mcurdart=1;
384         }
385         else
386         {
387           if (!this->mmap->is_free(*this, Bi+delta))
388           {
389             this->set_current_dart(this->mmap->beta(*this, Bi+delta));
390             this->mprev_op = OP_BETAJ;
391             mcurdart=3;
392           }
393           else
394           {
395             this->mprev_op = OP_END;
396             this->set_current_dart(this->mmap->null_handle);
397           }
398         }
399       }
400       else if (mcurdart==1)
401       {
402         if (!this->mmap->is_free(*this, Bi+delta))
403         {
404           this->set_current_dart(this->mmap->beta(*this, Bi+delta));
405           this->mprev_op = OP_BETAJ;
406           mcurdart=2;
407         }
408         else
409         {
410           this->mprev_op = OP_END;
411           this->set_current_dart(this->mmap->null_handle);
412         }
413       }
414       else if (mcurdart==2)
415       {
416         CGAL_assertion(!this->mmap->is_free(*this, Bi));
417         this->set_current_dart(this->mmap->beta(*this, Bi));
418         this->mprev_op = OP_BETAI;
419         mcurdart=3;
420       }
421       else
422       {
423         CGAL_assertion (mcurdart==3);
424         this->mprev_op = OP_END;
425         this->set_current_dart(this->mmap->null_handle);
426       }
427 
428       return *this;
429     }
430 
431     /// Postfix ++ operator.
432     Self operator++(int)
433     { Self res=*this; operator ++(); return res; }
434 
435   private:
436     /// mcurdart: number of the current dart (0,1,2 or 3).
437     char mcurdart;
438   };
439   //****************************************************************************
440   /* Class CMap_dart_iterator_basic_of_two_beta<Bi,delta>: to iterate
441    * on the darts of the orbit <Bi,Bi+delta>: Bi<Bi+delta<=dimension.
442    * Special case for Bi==0 and delta==2.
443    * Basic classes do not guaranty correct marks (i.e. do not unmark darts in
444    * the destructor, possible problem with the rewind). If you are not sure,
445    * use CMap_dart_iterator_basic_of_two_beta.
446    */
447   template <typename Map_,bool Const>
448   class CMap_dart_iterator_basic_of_two_beta<Map_,Const,0,2> :
449     public CMap_extend_iterator
450   <Map_, CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,0>, 2>
451   {
452   public:
453     typedef CMap_dart_iterator_basic_of_two_beta<Map_,Const,0,2> Self;
454     typedef CMap_extend_iterator
455     <Map_, CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,0>, 2> Base;
456 
457     typedef typename Base::Dart_handle Dart_handle;
458     typedef typename Base::Map Map;
459     typedef typename Map::size_type size_type;
460 
461     typedef Tag_true Use_mark;
462 
463     CGAL_static_assertion( 2<=Map::dimension );
464 
465   public:
466     /// Main constructor.
CMap_dart_iterator_basic_of_two_beta(Map & amap,Dart_handle adart,size_type amark)467     CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart,
468                                          size_type amark):
469       Base(amap, adart, amark)
470     {}
471   };
472   //****************************************************************************
473   /* Class CMap_dart_iterator_basic_of_two_beta<Bi,delta>: to iterate
474    * on the darts of the orbit <Bi,Bi+delta>: Bi<Bi+delta<=dimension.
475    * Special case for Bi==1 and delta==1.
476    * Basic classes do not guaranty correct marks (i.e. do not unmark darts in
477    * the destructor, possible problem with the rewind). If you are not sure,
478    * use CMap_dart_iterator_basic_of_two_beta.
479    */
480   template <typename Map_,bool Const>
481   class CMap_dart_iterator_basic_of_two_beta<Map_,Const,1,1> :
482     public CMap_extend_iterator
483   <Map_, CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1>, 2>
484   {
485   public:
486     typedef CMap_dart_iterator_basic_of_two_beta<Map_,Const,1,1> Self;
487     typedef CMap_extend_iterator
488     <Map_, CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1>, 2> Base;
489 
490     typedef typename Base::Dart_handle Dart_handle;
491     typedef typename Base::Map Map;
492     typedef typename Map::size_type size_type;
493 
494     typedef Tag_true Use_mark;
495 
496     CGAL_static_assertion( 2<=Map::dimension );
497 
498   public:
499     /// Main constructor.
CMap_dart_iterator_basic_of_two_beta(Map & amap,Dart_handle adart,size_type amark)500     CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart,
501                                          size_type amark):
502       Base(amap, adart, amark)
503     {}
504   };
505   //****************************************************************************
506   /* Class CMap_dart_iterator_basic_of_two_beta<Bi,delta>: to iterate
507    * on the darts of the orbit <Bi,Bi+delta>: Bi<Bi+delta<=dimension.
508    * Special case for Bi==0 and delta>2.
509    * Basic classes do not guaranty correct marks (i.e. do not unmark darts in
510    * the destructor, possible problem with the rewind). If you are not sure,
511    * use CMap_dart_iterator_basic_of_two_beta.
512    */
513   template <typename Map_,bool Const, unsigned int delta>
514   class CMap_dart_iterator_basic_of_two_beta<Map_,Const,0,delta> :
515     public CMap_dart_iterator<Map_,Const>
516   {
517   public:
518     typedef CMap_dart_iterator_basic_of_two_beta<Map_,Const,0,delta> Self;
519     typedef CMap_dart_iterator<Map_,Const> Base;
520 
521     typedef typename Base::Dart_handle Dart_handle;
522     typedef typename Base::Map Map;
523     typedef typename Map::size_type size_type;
524 
525     typedef Tag_false Use_mark;
526 
527     CGAL_static_assertion( delta>1 && delta<=Map::dimension );
528 
529   public:
530     /// Main constructor.
CMap_dart_iterator_basic_of_two_beta(Map & amap,Dart_handle adart)531     CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart):
532       Base(amap, adart),
533       mit(amap, adart),
534       mexist_betaj(false),
535       mprev_betaj(false),
536       mfirst_border(true)
537     { if (adart!=this->mmap->null_handle)
538         mexist_betaj=!this->mmap->is_free(adart, delta); }
539 
540     /// Main constructor.
CMap_dart_iterator_basic_of_two_beta(Map & amap,Dart_handle adart,size_type)541     CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart,
542                                          size_type /*amark*/):
543       Base(amap, adart),
544       mit(amap, adart),
545       mexist_betaj(false),
546       mprev_betaj(false),
547       mfirst_border(true)
548     { if (adart!=this->mmap->null_handle)
549         mexist_betaj=!this->mmap->is_free(adart, delta); }
550 
551     /// Prefix ++ operator.
552     Self& operator++()
553     {
554       CGAL_assertion(this->cont());
555       if (mexist_betaj && !mprev_betaj)
556       {
557         mprev_betaj = true;
558         mfirst_border = ! mfirst_border;
559         this->set_current_dart(this->mmap->beta(*this, delta));
560         this->mprev_op = OP_BETAJ;
561       }
562       else
563       {
564         mprev_betaj = false;
565         ++mit;
566         this->mprev_op = mit.prev_operation();
567         if ( !mit.cont() )
568           this->set_current_dart(this->mmap->null_handle);
569         else
570         {
571           if ( !mfirst_border )
572             this->set_current_dart(this->mmap->beta(mit, delta));
573           else
574             this->set_current_dart(mit);
575         }
576       }
577       return *this;
578     }
579 
580     /// Postfix ++ operator.
581     Self operator++(int)
582     { Self res=*this; operator ++(); return res; }
583 
584     /// Rewind of the iterator to its beginning.
rewind()585     void rewind()
586     {
587       Base::rewind();
588       mit.rewind();
589       mprev_betaj   = false;
590       mfirst_border = true;
591     }
592 
593   private:
594     /// Iterator on beta0
595     CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,0> mit;
596 
597     /// Boolean: true iff there are two half facets.
598     bool mexist_betaj;
599 
600     /// Boolean: true iff the last ++ used betaj.
601     bool mprev_betaj;
602 
603     /// Boolean: true iff the current dart is on the first border.
604     bool mfirst_border;
605   };
606   //****************************************************************************
607   /* Class CMap_dart_iterator_basic_of_two_beta<Bi,delta>: to iterate
608    * on the darts of the orbit <Bi,Bi+delta>: Bi<Bi+delta<=dimension.
609    * Special case for Bi==1 and delta>1.
610    * Basic classes do not guaranty correct marks (i.e. do not unmark darts in
611    * the destructor, possible problem with the rewind). If you are not sure,
612    * use CMap_dart_iterator_basic_of_two_beta.
613    */
614   template <typename Map_,bool Const, unsigned int delta>
615   class CMap_dart_iterator_basic_of_two_beta<Map_,Const,1,delta> :
616     public CMap_dart_iterator<Map_,Const>
617   {
618   public:
619     typedef CMap_dart_iterator_basic_of_two_beta<Map_,Const,1,delta> Self;
620     typedef CMap_dart_iterator<Map_,Const> Base;
621 
622     typedef typename Base::Dart_handle Dart_handle;
623     typedef typename Base::Map Map;
624     typedef typename Map::size_type size_type;
625 
626     typedef Tag_false Use_mark;
627 
628     CGAL_static_assertion( delta>1 && delta+1<=Map::dimension );
629 
630   public:
631     /// Main constructor.
CMap_dart_iterator_basic_of_two_beta(Map & amap,Dart_handle adart)632     CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart):
633       Base(amap, adart),
634       mit(amap, adart),
635       mexist_betaj(false),
636       mprev_betaj(false),
637       mfirst_border(true)
638     { if (adart!=this->mmap->null_handle)
639         mexist_betaj=!this->mmap->is_free(adart, 1+delta); }
640 
641     /// Main constructor.
CMap_dart_iterator_basic_of_two_beta(Map & amap,Dart_handle adart,size_type)642     CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart,
643                                          size_type /*amark*/):
644       Base(amap, adart),
645       mit(amap, adart),
646       mexist_betaj(false),
647       mprev_betaj(false),
648       mfirst_border(true)
649     { if (adart!=this->mmap->null_handle)
650         mexist_betaj=!this->mmap->is_free(adart, 1+delta); }
651 
652     /// Prefix ++ operator.
653     Self& operator++()
654     {
655       CGAL_assertion(this->cont());
656       if (mexist_betaj && !mprev_betaj)
657       {
658         mprev_betaj = true;
659         mfirst_border = ! mfirst_border;
660         this->set_current_dart(this->mmap->beta(*this, 1+delta));
661         this->mprev_op = OP_BETAJ;
662       }
663       else
664       {
665         mprev_betaj = false;
666         ++mit;
667         this->mprev_op = mit.prev_operation();
668         if ( !mit.cont() )
669           this->set_current_dart(this->mmap->null_handle);
670         else
671         {
672           if ( !mfirst_border )
673             this->set_current_dart(this->mmap->beta(mit, 1+delta));
674           else
675             this->set_current_dart(mit);
676         }
677       }
678       return *this;
679     }
680 
681     /// Postfix ++ operator.
682     Self operator++(int)
683     { Self res=*this; operator ++(); return res; }
684 
685     /// Rewind of the iterator to its beginning.
rewind()686     void rewind()
687     {
688       Base::rewind();
689       mit.rewind();
690       mprev_betaj   = false;
691       mfirst_border = true;
692     }
693 
694   private:
695     /// Iterator on beta1
696     CMap_dart_iterator_basic_of_orbit_generic<Map_,Const, 1> mit;
697 
698     /// Boolean: true iff there are two half facets.
699     bool mexist_betaj;
700 
701     /// Boolean: true iff the last ++ used betaj.
702     bool mprev_betaj;
703 
704     /// Boolean: true iff the current dart is on the first border.
705     bool mfirst_border;
706   };
707   //****************************************************************************
708   /* Class CMap_dart_iterator_basic_of_two_beta<Bi,delta>: to iterate
709    * on the darts of the orbit <Bi,Bi+delta>: Bi<Bi+delta<=dimension.
710    * Special case for Bi>1 and delta==1.
711    * Basic classes do not guaranty correct marks (i.e. do not unmark darts in
712    * the destructor, possible problem with the rewind). If you are not sure,
713    * use CMap_dart_iterator_basic_of_two_beta.
714    */
715   template <typename Map_,bool Const, int Bi>
716   class CMap_dart_iterator_basic_of_two_beta<Map_,Const,Bi,1> :
717     public CMap_dart_iterator<Map_,Const>
718   {
719   public:
720     typedef CMap_dart_iterator_basic_of_two_beta<Map_,Const,Bi,1> Self;
721     typedef CMap_dart_iterator<Map_,Const> Base;
722 
723     typedef typename Base::Dart_handle Dart_handle;
724     typedef typename Base::Map Map;
725     typedef typename Map::size_type size_type;
726 
727     typedef Tag_false Use_mark;
728 
729     CGAL_static_assertion( Bi>1 && Bi+1<=Map::dimension );
730 
731   public:
732     /// Main constructor.
CMap_dart_iterator_basic_of_two_beta(Map & amap,Dart_handle adart)733     CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart):
734       Base(amap, adart),
735       mfirst_dir(true),
736       mnext_try_betai(true)
737     {}
738 
739     /// Main constructor.
CMap_dart_iterator_basic_of_two_beta(Map & amap,Dart_handle adart,size_type)740     CMap_dart_iterator_basic_of_two_beta(Map& amap, Dart_handle adart,
741                                          size_type /*amark*/):
742       Base(amap, adart),
743       mfirst_dir(true),
744       mnext_try_betai(true)
745     {}
746 
747     /// Rewind of the iterator to its beginning.
rewind()748     void rewind()
749     {
750       Base::rewind();
751       mfirst_dir = true;
752       mnext_try_betai   = true;
753     }
754 
755     /// Prefix ++ operator.
756     Self& operator++()
757     {
758       CGAL_assertion(this->cont());
759 
760       if (mfirst_dir)
761       {
762         if (mnext_try_betai)
763         {
764           if (this->mmap->is_free(*this, Bi))
765           {
766             mfirst_dir = false;
767             if (this->mmap->is_free(this->mfirst_dart, Bi+1))
768             {
769               this->mprev_op = OP_END;
770               this->set_current_dart(this->mmap->null_handle);
771             }
772             else
773             {
774               this->set_current_dart(this->mmap->beta(this->mfirst_dart, Bi+1));
775               this->mprev_op = OP_JUMP;
776             }
777           }
778           else
779           {
780             this->set_current_dart(this->mmap->beta(*this, Bi));
781             mnext_try_betai = false;
782             this->mprev_op = OP_BETAI;
783           }
784         }
785         else
786         {
787           if (this->mmap->is_free(*this, Bi+1))
788           {
789             mfirst_dir = false;
790             if (this->mmap->is_free(this->mfirst_dart, Bi+1))
791             {
792               this->mprev_op = OP_END;
793               this->set_current_dart(this->mmap->null_handle);
794             }
795             else
796             {
797               this->set_current_dart(this->mmap->beta(this->mfirst_dart, Bi+1));
798               mnext_try_betai = true;
799               this->mprev_op = OP_JUMP;
800             }
801           }
802           else
803           {
804             this->set_current_dart(this->mmap->beta(*this, Bi+1));
805             if ((*this)==this->mfirst_dart)
806             {
807               this->mprev_op = OP_END;
808               this->set_current_dart(this->mmap->null_handle);
809             }
810             else
811             {
812               mnext_try_betai = true;
813               this->mprev_op = OP_BETAJ;
814             }
815           }
816         }
817       }
818       else
819       {
820         if (mnext_try_betai)
821         {
822           if (this->mmap->is_free(*this, Bi))
823           {
824             this->mprev_op = OP_END;
825             this->set_current_dart(this->mmap->null_handle);
826           }
827           else
828           {
829             this->set_current_dart(this->mmap->beta(*this, Bi));
830             mnext_try_betai = false;
831             this->mprev_op = OP_BETAI;
832           }
833         }
834         else
835         {
836           if (this->mmap->is_free(*this, Bi+1))
837           {
838             this->mprev_op = OP_END;
839             this->set_current_dart(this->mmap->null_handle);
840           }
841           else
842           {
843             this->set_current_dart(this->mmap->beta(*this, Bi+1));
844             mnext_try_betai = true;
845             this->mprev_op = OP_BETAJ;
846           }
847         }
848       }
849       return *this;
850     }
851 
852     /// Postfix ++ operator.
853     Self operator++(int)
854     { Self res=*this; operator ++(); return res; }
855 
856   private:
857     /// Boolean: true iff we turn in the first direction (i.e. using betai).
858     bool mfirst_dir;
859 
860     /// Boolean: true iff the next ++ must use betai.
861     bool mnext_try_betai;
862   };
863   //****************************************************************************
864   /* Class CMap_dart_iterator_basic_of_orbit<Bi,Bj>: to iterate
865    * on the darts of the orbit <Bi,Bj>: Bi<Bj<=dimension.
866    * Basic classes do not guaranty correct marks (i.e. do not unmark darts in
867    * the destructor, possible problem with the rewind). If you are not sure,
868    * use CMap_dart_iterator_basic_of_orbit.
869    */
870   template <typename Map_,bool Const,int Bi,int Bj>
871   class CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,Bi,Bj>:
872     public CMap_dart_iterator_basic_of_two_beta<Map_,Const,Bi,Bj-Bi>
873   {
874   public:
875     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,Bi,Bj> Self;
876     typedef CMap_dart_iterator_basic_of_two_beta<Map_,Const,Bi,Bj-Bi> Base;
877 
878     typedef typename Base::Dart_handle Dart_handle;
879     typedef typename Base::Map Map;
880     typedef typename Map::size_type size_type;
881 
882     typedef typename Base::Use_mark Use_mark;
883 
884   public:
885     /// Main constructor.
CMap_dart_iterator_basic_of_orbit_generic(Map & amap,Dart_handle adart)886     CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart) :
887       Base(amap, adart)
888     {}
889 
890     /// Main constructor.
CMap_dart_iterator_basic_of_orbit_generic(Map & amap,Dart_handle adart,size_type amark)891     CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart,
892                                               size_type amark):
893       Base(amap, adart, amark)
894     {}
895   };
896   //****************************************************************************
897   /* Generic nD version.
898    */
899   template <typename Map_,bool Const,int Bi,int Bj, int Bk, int... Beta>
900   class CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,Bi,Bj,Bk,Beta...>:
901     public CMap_extend_iterator<Map_,
902                                 CMap_dart_iterator_basic_of_orbit_generic
903                                 <Map_,Const,Bi,Bj,Beta...>,
904                                 Bk>
905   {
906   public:
907     typedef CMap_dart_iterator_basic_of_orbit_generic
908     <Map_,Const,Bi,Bj,Bk,Beta...> Self;
909     typedef CMap_extend_iterator<Map_,
910                                  CMap_dart_iterator_basic_of_orbit_generic
911                                  <Map_,Const,Bi,Bj,Beta...>,
912                                  Bk> Base;
913 
914     typedef typename Base::Dart_handle Dart_handle;
915     typedef typename Base::Map Map;
916     typedef typename Map::size_type size_type;
917 
918     /// True iff this iterator is basic
919     typedef Tag_true Basic_iterator;
920 
921   public:
922     /// Main constructor.
CMap_dart_iterator_basic_of_orbit_generic(Map & amap,Dart_handle adart,size_type amark)923     CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart,
924                                               size_type amark):
925       Base(amap, adart, amark)
926     {}
927   };
928   //****************************************************************************
929   // TODO? we can optimize the iterators<Bi,Bj,Bk> when
930   // 1<Bi and Bi+2<=Bj and Bj+2<=Bk but there is no real interest...
931   //****************************************************************************
932   template<typename Map,int...Beta>
933   class CMap_dart_iterator_basic_of_orbit:
934     public CMap_dart_iterator_basic_of_orbit_generic<Map,false,Beta...>
935   {
936   public:
937     typedef CMap_dart_iterator_basic_of_orbit<Map,Beta...> Self;
938     typedef CMap_dart_iterator_basic_of_orbit_generic<Map,false,Beta...> Base;
939 
940     typedef typename Map::Dart_handle Dart_handle;
941     typedef typename Map::size_type size_type;
942 
943     /// Main constructor.
CMap_dart_iterator_basic_of_orbit(Map & amap,Dart_handle adart)944     CMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart):
945       Base(amap,adart)
946     {}
947     /// Main constructor.
CMap_dart_iterator_basic_of_orbit(Map & amap,Dart_handle adart,size_type amark)948     CMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart,size_type amark):
949       Base(amap,adart,amark)
950     {}
951   };
952   //****************************************************************************
953   /* Class CMap_dart_iterator_basic_of_all: to iterate onto all the
954    * darts of the map.
955    */
956   template <typename Map_,bool Const=false>
957   class CMap_dart_iterator_basic_of_all: public CMap_dart_iterator<Map_,Const>
958   {
959   public:
960     typedef CMap_dart_iterator_basic_of_all Self;
961     typedef CMap_dart_iterator<Map_,Const> Base;
962 
963     typedef typename Base::Dart_handle Dart_handle;
964     typedef typename Base::Map Map;
965     typedef typename Map::size_type size_type;
966 
967     typedef Tag_false Use_mark;
968 
969   public:
970     /// Main constructor.
CMap_dart_iterator_basic_of_all(Map & amap)971     CMap_dart_iterator_basic_of_all(Map& amap):
972       Base(amap, amap.darts().begin())
973     {}
974     /// Main constructor.
CMap_dart_iterator_basic_of_all(Map & amap,size_type)975     CMap_dart_iterator_basic_of_all(Map& amap, size_type /*amark*/):
976       Base(amap, amap.darts().begin())
977     {}
978 
979     /// Constructor with a dart in parameter (for end iterator).
CMap_dart_iterator_basic_of_all(Map & amap,Dart_handle adart)980     CMap_dart_iterator_basic_of_all(Map& amap, Dart_handle adart):
981       Base(amap, adart)
982     {}
983     /// Constructor with a dart in parameter (for end iterator).
CMap_dart_iterator_basic_of_all(Map & amap,Dart_handle adart,size_type)984     CMap_dart_iterator_basic_of_all(Map& amap, Dart_handle adart,
985                                     size_type /*amark*/):
986       Base(amap, adart)
987     {}
988 
989     /// Prefix ++ operator.
990     Self& operator++()
991     {
992       CGAL_assertion(this->cont());
993 
994       Base::operator++();
995       if ( (*this) != this->mmap->darts().end())
996       { this->mprev_op = OP_POP; }
997       else
998       {
999         this->set_current_dart(this->mmap->null_handle);
1000         this->mprev_op = OP_END;
1001       }
1002       return *this;
1003     }
1004 
1005     /// Postfix ++ operator.
1006     Self operator++(int)
1007     { Self res=*this; operator ++(); return res; }
1008   };
1009   //****************************************************************************
1010   //***************************CELL*ITERATORS***********************************
1011   //****************************************************************************
1012   //****************************************************************************
1013   // i-Cell iterator in combinatorial map of dimension d, i>1
1014   // i<=Map::dimension+1 (for i==Map::dimension+1, iterate on the connected
1015   // component)
1016   template<typename Map_,int i,int d=Map_::dimension,bool Const=false>
1017   class CMap_dart_iterator_basic_of_cell: public CMap_dart_iterator<Map_,Const>
1018   {
1019   public:
1020     typedef CMap_dart_iterator_basic_of_cell<Map_,i,d,Const> Self;
1021     typedef CMap_dart_iterator<Map_,Const> Base;
1022 
1023     typedef typename Base::Dart_handle Dart_handle;
1024     typedef typename Base::Map Map;
1025     typedef typename Map::size_type size_type;
1026 
1027     typedef Tag_true Use_mark;
1028 
1029     CGAL_static_assertion( i>1 && i<=Map::dimension+1 );
1030 
1031   public:
1032     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart,size_type amark)1033     CMap_dart_iterator_basic_of_cell(Map& amap,
1034                                      Dart_handle adart,
1035                                      size_type amark):
1036       Base(amap, adart),
1037       mmark_number(amark)
1038     {
1039       if (adart!=this->mmap->null_handle)
1040       {
1041         this->mmap->mark_null_dart(mmark_number);
1042         this->mmap->mark(adart, mmark_number);
1043       }
1044     }
1045 
1046     /// Rewind of the iterator to its beginning.
rewind()1047     void rewind()
1048     {
1049       CGAL_assertion(mmark_number != Map::INVALID_MARK);
1050       Base::rewind();
1051       mto_treat = std::queue<Dart_handle>();
1052       this->mmap->mark(*this, mmark_number);
1053       this->mmap->mark_null_dart(mmark_number);
1054     }
1055 
1056     /// Prefix ++ operator.
1057     Self& operator++()
1058     {
1059       CGAL_assertion(mmark_number != Map::INVALID_MARK);
1060       CGAL_assertion(this->cont());
1061       Dart_handle nd = this->mmap->null_handle;
1062 
1063       for ( unsigned int k=0; k<i; ++k )
1064       {
1065         if ( this->is_unmarked((*this), k, mmark_number) )
1066         {
1067           if (nd == this->mmap->null_handle)
1068           {
1069             nd = this->mmap->beta(*this, k);
1070             CGAL_assertion(nd!=this->mmap->null_dart_handle);
1071             this->mprev_op = OP_BETAI;
1072           }
1073           else
1074           {
1075             mto_treat.push(this->mmap->beta(*this, k));
1076           }
1077           this->mmap->mark(this->mmap->beta(*this, k), mmark_number);
1078         }
1079       }
1080       for ( unsigned int k=i+1; k<=d; ++k )
1081       {
1082         if ( this->is_unmarked((*this), k, mmark_number) )
1083         {
1084           if (nd == this->mmap->null_handle)
1085           {
1086             nd = this->mmap->beta(*this, k);
1087             CGAL_assertion(nd!=this->mmap->null_dart_handle);
1088             this->mprev_op = OP_BETAI;
1089           }
1090           else
1091           {
1092             mto_treat.push(this->mmap->beta(*this, k));
1093           }
1094           this->mmap->mark(this->mmap->beta(*this, k), mmark_number);
1095         }
1096       }
1097 
1098       if (nd == this->mmap->null_handle)
1099       {
1100         if (!mto_treat.empty())
1101         {
1102           nd = mto_treat.front();
1103           mto_treat.pop();
1104           this->mprev_op = OP_POP;
1105         }
1106         else
1107         {
1108           this->mprev_op = OP_END;
1109         }
1110       }
1111 
1112       this->set_current_dart(nd);
1113       return *this;
1114     }
1115 
1116     /// Postfix ++ operator.
1117     Self operator++(int)
1118     { Self res=*this; operator ++(); return res; }
1119 
1120   protected:
1121     /// Queue of darts to process.
1122     std::queue<Dart_handle> mto_treat;
1123 
1124     /// Index of the used mark.
1125     size_type mmark_number;
1126   };
1127   //****************************************************************************
1128   // i-Cell iterator in combinatorial map of dimension d, i==1.
1129   template<typename Map_,int d,bool Const>
1130   class CMap_dart_iterator_basic_of_cell<Map_,1,d,Const>:
1131     public CMap_dart_iterator<Map_,Const>
1132   {
1133   public:
1134     typedef CMap_dart_iterator_basic_of_cell<Map_,1,d,Const> Self;
1135     typedef CMap_dart_iterator<Map_,Const> Base;
1136 
1137     typedef typename Base::Dart_handle Dart_handle;
1138     typedef typename Base::Map Map;
1139     typedef typename Map::size_type size_type;
1140 
1141     typedef Tag_true Use_mark;
1142 
1143   public:
1144     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart,size_type amark)1145     CMap_dart_iterator_basic_of_cell(Map& amap,
1146                                      Dart_handle adart,
1147                                      size_type amark):
1148       Base(amap, adart),
1149       mmark_number(amark)
1150     {
1151       if (adart!=this->mmap->null_handle)
1152       {
1153         this->mmap->mark(adart, mmark_number);
1154         this->mmap->mark_null_dart(mmark_number);
1155       }
1156     }
1157 
1158     /// Rewind of the iterator to its beginning.
rewind()1159     void rewind()
1160     {
1161       CGAL_assertion(mmark_number != Map::INVALID_MARK);
1162       Base::rewind();
1163       mto_treat = std::queue<Dart_handle>();
1164       this->mmap->mark((*this), mmark_number);
1165       this->mmap->mark_null_dart(mmark_number);
1166     }
1167 
1168     /// Prefix ++ operator.
1169     Self& operator++()
1170     {
1171       CGAL_assertion(mmark_number != Map::INVALID_MARK);
1172       CGAL_assertion(this->cont());
1173 
1174       Dart_handle nd = this->mmap->null_handle;
1175 
1176       for ( unsigned int k=2; k<=d; ++k )
1177       {
1178         if ( this->is_unmarked((*this), k, mmark_number) )
1179         {
1180           if (nd == this->mmap->null_handle)
1181           {
1182             nd = this->mmap->beta(*this, k);
1183             CGAL_assertion(nd!=this->mmap->null_dart_handle);
1184             this->mprev_op = OP_BETAI;
1185           }
1186           else
1187           {
1188             mto_treat.push(this->mmap->beta(*this, k));
1189           }
1190           this->mmap->mark(this->mmap->beta(*this, k), mmark_number);
1191         }
1192       }
1193 
1194       if (nd == this->mmap->null_handle)
1195       {
1196         if (!mto_treat.empty())
1197         {
1198           nd = mto_treat.front();
1199           CGAL_assertion(nd!=this->mmap->null_dart_handle);
1200           mto_treat.pop();
1201           this->mprev_op = OP_POP;
1202         }
1203         else
1204         {
1205           this->mprev_op = OP_END;
1206         }
1207       }
1208 
1209       this->set_current_dart(nd);
1210       return *this;
1211     }
1212 
1213     /// Postfix ++ operator.
1214     Self operator++(int)
1215     { Self res=*this; operator ++(); return res; }
1216 
1217   protected:
1218     /// Queue of darts to process.
1219     std::queue<Dart_handle> mto_treat;
1220 
1221     /// Index of the used mark.
1222     size_type mmark_number;
1223   };
1224   //****************************************************************************
1225   // 0-Cell iterator in combinatorial map of dimension d
1226   template<typename Map_,int d,bool Const>
1227   class CMap_dart_iterator_basic_of_cell<Map_,0,d,Const>:
1228     public CMap_dart_iterator<Map_,Const>
1229   {
1230   public:
1231     typedef CMap_dart_iterator_basic_of_cell<Map_,0,d,Const> Self;
1232     typedef CMap_dart_iterator<Map_,Const> Base;
1233 
1234     typedef typename Base::Dart_handle Dart_handle;
1235     typedef typename Base::Map Map;
1236     typedef typename Map::size_type size_type;
1237 
1238     typedef Tag_true Use_mark;
1239 
1240   public:
1241     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart,size_type amark)1242     CMap_dart_iterator_basic_of_cell(Map& amap,
1243                                      Dart_handle adart,
1244                                      size_type amark):
1245       Base(amap, adart),
1246       mmark_number(amark)
1247     { if (adart!=this->mmap->null_handle)
1248       {
1249         this->mmap->mark(adart, mmark_number);
1250         this->mmap->mark_null_dart(mmark_number);
1251       }
1252     }
1253 
1254     /// Rewind of the iterator to its beginning.
rewind()1255     void rewind()
1256     {
1257       CGAL_assertion(mmark_number != Map::INVALID_MARK);
1258       Base::rewind();
1259       mto_treat = std::queue<Dart_handle>();
1260       this->mmap->mark((*this), mmark_number);
1261       this->mmap->mark_null_dart(mmark_number);
1262     }
1263 
1264     /// Prefix ++ operator.
1265     Self& operator++()
1266     {
1267       CGAL_assertion(mmark_number != Map::INVALID_MARK);
1268       CGAL_assertion(this->cont());
1269 
1270       Dart_handle nd = this->mmap->null_handle;
1271 
1272       for ( unsigned int k=2; k<=d; ++k )
1273       {
1274         if ( this->is_unmarked2((*this), 0, k, mmark_number) )
1275         {
1276           if (nd == this->mmap->null_handle)
1277           {
1278             nd = this->mmap->beta(*this, 0, k);
1279             CGAL_assertion(nd!=this->mmap->null_dart_handle);
1280             this->mprev_op = OP_BETA0I;
1281           }
1282           else
1283           {
1284             mto_treat.push(this->mmap->beta(*this, 0, k));
1285           }
1286           this->mmap->mark(this->mmap->beta(*this, 0, k), mmark_number);
1287         }
1288         if ( this->is_unmarked2((*this), k, 1, mmark_number) )
1289         {
1290           if (nd == this->mmap->null_handle)
1291           {
1292             nd = this->mmap->beta(*this, k, 1);
1293             CGAL_assertion(nd!=this->mmap->null_dart_handle);
1294             this->mprev_op = OP_BETAI1;
1295           }
1296           else
1297           {
1298             mto_treat.push(this->mmap->beta(*this, k, 1));
1299           }
1300           this->mmap->mark(this->mmap->beta(*this, k, 1), mmark_number);
1301         }
1302         for ( unsigned int l=k+1; l<=d; ++l )
1303         {
1304           if ( this->is_unmarked2((*this), k, l, mmark_number) )
1305           {
1306             if (nd == this->mmap->null_handle)
1307             {
1308               nd = this->mmap->beta(*this, k, l);
1309               CGAL_assertion(nd!=this->mmap->null_dart_handle);
1310               this->mprev_op = OP_BETAIJ;
1311             }
1312             else
1313             {
1314               mto_treat.push(this->mmap->beta(*this, k, l));
1315             }
1316             this->mmap->mark(this->mmap->beta(*this, k, l), mmark_number);
1317           }
1318           if ( this->is_unmarked2((*this), l, k, mmark_number) )
1319           {
1320             if (nd == this->mmap->null_handle)
1321             {
1322               nd = this->mmap->beta(*this, l, k);
1323               CGAL_assertion(nd!=this->mmap->null_dart_handle);
1324               this->mprev_op = OP_BETAJI;
1325             }
1326             else
1327             {
1328               mto_treat.push(this->mmap->beta(*this, l, k));
1329             }
1330             this->mmap->mark(this->mmap->beta(*this, l, k), mmark_number);
1331           }
1332         }
1333       }
1334 
1335       if (nd == this->mmap->null_handle)
1336       {
1337         if (!mto_treat.empty())
1338         {
1339           nd = mto_treat.front();
1340           CGAL_assertion(nd!=this->mmap->null_dart_handle);
1341           mto_treat.pop();
1342           this->mprev_op = OP_POP;
1343         }
1344         else
1345         {
1346           this->mprev_op = OP_END;
1347         }
1348       }
1349 
1350       this->set_current_dart(nd);
1351       return *this;
1352     }
1353 
1354     /// Postfix ++ operator.
1355     Self operator++(int)
1356     { Self res=*this; operator ++(); return res; }
1357 
1358   protected:
1359     /// Queue of darts to process.
1360     std::queue<Dart_handle> mto_treat;
1361 
1362     /// Index of the used mark.
1363     size_type mmark_number;
1364   };
1365   //****************************************************************************
1366   // Specialization for edge in 2D
1367   template<typename Map_,bool Const>
1368   class CMap_dart_iterator_basic_of_cell<Map_,1,2,Const>:
1369     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,2>
1370   {
1371   public:
1372     typedef CMap_dart_iterator_basic_of_cell<Map_,1,2,Const> Self;
1373     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,2> Base;
1374 
1375     typedef typename Base::Dart_handle Dart_handle;
1376     typedef typename Base::Map Map;
1377     typedef typename Map::size_type size_type;
1378 
1379     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart)1380     CMap_dart_iterator_basic_of_cell(Map& amap,
1381                                      Dart_handle adart):
1382       Base(amap, adart)
1383     {}
1384 
1385     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart,size_type)1386     CMap_dart_iterator_basic_of_cell(Map& amap,
1387                                      Dart_handle adart,
1388                                      size_type /*amark*/):
1389       Base(amap, adart)
1390     {}
1391   };
1392   //****************************************************************************
1393   // Specialization for facet in 2D
1394   template<typename Map_,bool Const>
1395   class CMap_dart_iterator_basic_of_cell<Map_,2,2,Const>:
1396     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1>
1397   {
1398   public:
1399     typedef CMap_dart_iterator_basic_of_cell<Map_,2,2,Const> Self;
1400     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1> Base;
1401 
1402     typedef typename Base::Dart_handle Dart_handle;
1403     typedef typename Base::Map Map;
1404     typedef typename Map::size_type size_type;
1405 
1406     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart)1407     CMap_dart_iterator_basic_of_cell(Map& amap,
1408                                      Dart_handle adart):
1409       Base(amap, adart)
1410     {}
1411 
1412     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart,size_type)1413     CMap_dart_iterator_basic_of_cell(Map& amap,
1414                                      Dart_handle adart,
1415                                      size_type /*amark*/):
1416       Base(amap, adart)
1417     {}
1418   };
1419   //****************************************************************************
1420   // Specialization for cc in 2D
1421   template<typename Map_,bool Const>
1422   class CMap_dart_iterator_basic_of_cell<Map_,3,2,Const>:
1423     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1,2>
1424   {
1425   public:
1426     typedef CMap_dart_iterator_basic_of_cell<Map_,3,2,Const> Self;
1427     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1,2> Base;
1428 
1429     typedef typename Base::Dart_handle Dart_handle;
1430     typedef typename Base::Map Map;
1431     typedef typename Map::size_type size_type;
1432 
1433     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart,size_type amark)1434     CMap_dart_iterator_basic_of_cell(Map& amap,
1435                                      Dart_handle adart,
1436                                      size_type amark):
1437       Base(amap, adart, amark)
1438     {}
1439   };
1440   //****************************************************************************
1441   // Specialization for edge in 3D
1442   template<typename Map_,bool Const>
1443   class CMap_dart_iterator_basic_of_cell<Map_,1,3,Const>:
1444     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,2,3>
1445   {
1446   public:
1447     typedef CMap_dart_iterator_basic_of_cell<Map_,1,3,Const> Self;
1448     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,2,3> Base;
1449 
1450     typedef typename Base::Dart_handle Dart_handle;
1451     typedef typename Base::Map Map;
1452     typedef typename Map::size_type size_type;
1453 
1454     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart)1455     CMap_dart_iterator_basic_of_cell(Map& amap,
1456                                      Dart_handle adart):
1457       Base(amap, adart)
1458     {}
1459 
1460     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart,size_type)1461     CMap_dart_iterator_basic_of_cell(Map& amap,
1462                                      Dart_handle adart,
1463                                      size_type /*amark*/): Base(amap, adart)
1464     {}
1465   };
1466   //****************************************************************************
1467   // Specialization for facet in 3D
1468   template<typename Map_,bool Const>
1469   class CMap_dart_iterator_basic_of_cell<Map_,2,3,Const>:
1470     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1,3>
1471   {
1472   public:
1473     typedef CMap_dart_iterator_basic_of_cell<Map_,2,3,Const> Self;
1474     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1,3> Base;
1475 
1476     typedef typename Base::Dart_handle Dart_handle;
1477     typedef typename Base::Map Map;
1478     typedef typename Map::size_type size_type;
1479 
1480     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart)1481     CMap_dart_iterator_basic_of_cell(Map& amap,
1482                                      Dart_handle adart):
1483       Base(amap, adart)
1484     {}
1485 
1486     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart,size_type)1487     CMap_dart_iterator_basic_of_cell(Map& amap,
1488                                      Dart_handle adart,
1489                                      size_type /*amark*/): Base(amap, adart)
1490     {}
1491   };
1492   //****************************************************************************
1493   // Specialization for volume in 3D
1494   template<typename Map_,bool Const>
1495   class CMap_dart_iterator_basic_of_cell<Map_,3,3,Const>:
1496     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1,2>
1497   {
1498   public:
1499     typedef CMap_dart_iterator_basic_of_cell<Map_,3,3,Const> Self;
1500     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1,2> Base;
1501 
1502     typedef typename Base::Dart_handle Dart_handle;
1503     typedef typename Base::Map Map;
1504     typedef typename Map::size_type size_type;
1505 
1506     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart,size_type amark)1507     CMap_dart_iterator_basic_of_cell(Map& amap,
1508                                      Dart_handle adart,
1509                                      size_type amark):
1510       Base(amap, adart, amark)
1511     {}
1512   };
1513   //****************************************************************************
1514   // Specialization for cc in 3D
1515   template<typename Map_,bool Const>
1516   class CMap_dart_iterator_basic_of_cell<Map_,4,3,Const>:
1517     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1,2,3>
1518   {
1519   public:
1520     typedef CMap_dart_iterator_basic_of_cell<Map_,4,3,Const> Self;
1521     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1,2,3> Base;
1522 
1523     typedef typename Base::Dart_handle Dart_handle;
1524     typedef typename Base::Map Map;
1525     typedef typename Map::size_type size_type;
1526 
1527     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart,size_type amark)1528     CMap_dart_iterator_basic_of_cell(Map& amap,
1529                                      Dart_handle adart,
1530                                      size_type amark):
1531       Base(amap, adart, amark)
1532     {}
1533   };
1534   //****************************************************************************
1535   /* Class CMap_dart_iterator_basic_of_cell<Map,0,2>: to iterate onto the
1536    * darts of the orbit vertex in 2D.
1537    */
1538   template <typename Map_,bool Const>
1539   class CMap_dart_iterator_basic_of_cell<Map_,0,2,Const>:
1540     public CMap_dart_iterator<Map_,Const>
1541   {
1542   public:
1543     typedef CMap_dart_iterator_basic_of_cell<Map_,0,2,Const> Self;
1544     typedef CMap_dart_iterator<Map_,Const> Base;
1545 
1546     typedef typename Base::Dart_handle Dart_handle;
1547     typedef typename Base::Map Map;
1548     typedef typename Map::size_type size_type;
1549 
1550     typedef Tag_false Use_mark;
1551 
1552   public:
1553     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart)1554     CMap_dart_iterator_basic_of_cell(Map& amap,
1555                                      Dart_handle adart):
1556       Base(amap, adart),
1557       mfirst_dir(true)
1558     {}
1559 
1560     /// Main constructor.
CMap_dart_iterator_basic_of_cell(Map & amap,Dart_handle adart,size_type)1561     CMap_dart_iterator_basic_of_cell(Map& amap,
1562                                      Dart_handle adart,
1563                                      size_type /*amark*/):
1564       Base(amap, adart),
1565       mfirst_dir(true)
1566     {}
1567 
1568     /// Rewind of the iterator to its beginning.
rewind()1569     void rewind()
1570     {
1571       Base::rewind();
1572       mfirst_dir = true;
1573     }
1574 
1575     /// Prefix ++ operator.
1576     Self& operator++()
1577     {
1578       CGAL_assertion(this->cont());
1579 
1580       if (mfirst_dir)
1581       {
1582         this->set_current_dart(this->mmap->beta(*this, 0, 2));
1583         if ((*this)==this->mmap->null_dart_handle)
1584         {
1585           mfirst_dir = false;
1586           this->set_current_dart(this->mmap->beta(this->mfirst_dart, 2, 1));
1587           if ((*this)==this->mmap->null_dart_handle)
1588           {
1589             this->mprev_op = OP_END;
1590             this->set_current_dart(this->mmap->null_handle);
1591           }
1592           else
1593           {
1594             this->mprev_op = OP_BETAI1;
1595           }
1596         }
1597         else
1598         {
1599           if ((*this)==this->mfirst_dart)
1600           {
1601             this->mprev_op = OP_END;
1602             this->set_current_dart(this->mmap->null_handle);
1603           }
1604           else
1605             this->mprev_op = OP_BETA0I;
1606         }
1607       }
1608       else
1609       {
1610         this->set_current_dart(this->mmap->beta(*this, 2, 1));
1611         if ((*this) == this->mmap->null_dart_handle)
1612         {
1613           this->mprev_op = OP_END;
1614           this->set_current_dart(this->mmap->null_handle);
1615         }
1616         else
1617           this->mprev_op = OP_BETA21;
1618       }
1619       return *this;
1620     }
1621 
1622     /// Postfix ++ operator.
1623     Self operator++(int)
1624     { Self res=*this; operator ++(); return res; }
1625 
1626   protected:
1627     /// Boolean: true iff we turn in the first direction (i.e. using beta02).
1628     bool mfirst_dir;
1629   };
1630   //****************************************************************************
1631   //*************************ITERATORS*NON*BASIC********************************
1632   //****************************************************************************
1633   //****************************************************************************
1634   template<typename Map_,bool Const,int...Beta>
1635   class CMap_dart_iterator_of_orbit_generic:
1636     public  CMap_non_basic_iterator<Map_,
1637                                     CMap_dart_iterator_basic_of_orbit_generic
1638                                     <Map_,Const,Beta...> >
1639   {
1640   public:
1641     typedef CMap_dart_iterator_of_orbit_generic<Map_,Const,Beta...> Self;
1642     typedef CMap_non_basic_iterator<Map_,
1643                                     CMap_dart_iterator_basic_of_orbit_generic
1644                                     <Map_,Const,Beta...> > Base;
1645 
1646     typedef typename Base::Map Map;
1647     typedef typename Base::Dart_handle Dart_handle;
1648 
1649     /// Main constructor.
CMap_dart_iterator_of_orbit_generic(Map & amap,Dart_handle adart1)1650     CMap_dart_iterator_of_orbit_generic(Map& amap, Dart_handle adart1):
1651       Base(amap, adart1)
1652     {}
1653   };
1654   //****************************************************************************
1655   template<typename Map_,unsigned int...Beta>
1656   class CMap_dart_iterator_of_orbit:
1657     public CMap_dart_iterator_of_orbit_generic<Map_,false,Beta...>
1658   {
1659   public:
1660     typedef CMap_dart_iterator_of_orbit<Map_,Beta...> Self;
1661     typedef CMap_dart_iterator_of_orbit_generic<Map_,false,Beta...> Base;
1662 
1663     typedef typename Base::Dart_handle Dart_handle;
1664 
1665     /// Main constructor.
CMap_dart_iterator_of_orbit(Map_ & amap,Dart_handle adart)1666     CMap_dart_iterator_of_orbit(Map_& amap, Dart_handle adart):
1667       Base(amap, adart)
1668     {}
1669   };
1670   //****************************************************************************
1671   template<typename Map_,int i,int d=Map_::dimension,bool Const=false>
1672   class CMap_dart_iterator_of_cell:
1673     public CMap_non_basic_iterator<Map_,CMap_dart_iterator_basic_of_cell
1674                                    <Map_,i,d,Const> >
1675   {
1676   public:
1677     typedef CMap_dart_iterator_basic_of_cell<Map_,i,d,Const> Self;
1678     typedef CMap_non_basic_iterator<Map_,
1679                                     CMap_dart_iterator_basic_of_cell
1680                                     <Map_,i,d,Const> > Base;
1681 
1682     typedef typename Base::Dart_handle Dart_handle;
1683     typedef typename Base::Map Map;
1684 
1685     /// Main constructor.
CMap_dart_iterator_of_cell(Map & amap,Dart_handle adart1)1686     CMap_dart_iterator_of_cell(Map& amap, Dart_handle adart1):
1687       Base(amap, adart1)
1688     {}
1689   };
1690   //****************************************************************************
1691   //********************ITERATOR*INVOLUTION*************************************
1692   //****************************************************************************
1693   // i-involution iterator in combinatorial map of dimension d,
1694   // 2<i<=Map::dimension. Iterate by using all beta between 0 and d,
1695   // except beta(i-1), betai and beta(i+1)
1696   template<typename Map_,int i,int d=Map_::dimension,bool Const=false>
1697   class CMap_dart_iterator_basic_of_involution;
1698 
1699   template<typename Map_,int i,int d,bool Const>
1700   class CMap_dart_iterator_basic_of_involution:
1701     public CMap_dart_iterator<Map_,Const>
1702   {
1703   public:
1704     typedef CMap_dart_iterator_basic_of_involution<Map_,i,d,Const> Self;
1705     typedef CMap_dart_iterator<Map_,Const> Base;
1706 
1707     typedef typename Base::Dart_handle Dart_handle;
1708     typedef typename Base::Map Map;
1709     typedef typename Map::size_type size_type;
1710 
1711     typedef Tag_true Use_mark;
1712 
1713     /// True iff this iterator is basic
1714     typedef Tag_true Basic_iterator;
1715 
1716   public:
1717     /// Main constructor.
CMap_dart_iterator_basic_of_involution(Map & amap,Dart_handle adart,size_type amark)1718     CMap_dart_iterator_basic_of_involution(Map& amap,
1719                                            Dart_handle adart,
1720                                            size_type amark):
1721       Base(amap, adart),
1722       mmark_number(amark)
1723     {
1724       CGAL_assertion( d>=3 && d<=Map::dimension );
1725       CGAL_assertion( i>=3 && i<=Map::dimension );
1726       if (adart!=this->mmap->null_handle)
1727       {
1728         this->mmap->mark(adart, mmark_number);
1729         this->mmap->mark_null_dart(mmark_number);
1730       }
1731     }
1732 
1733     /// Rewind of the iterator to its beginning.
rewind()1734     void rewind()
1735     {
1736       CGAL_assertion(mmark_number != Map::INVALID_MARK);
1737       Base::rewind();
1738       mto_treat = std::queue<Dart_handle>();
1739       this->mmap->mark((*this), mmark_number);
1740       this->mmap->mark_null_dart(mmark_number);
1741     }
1742 
1743     /// Prefix ++ operator.
1744     Self& operator++()
1745     {
1746       CGAL_assertion(mmark_number != Map::INVALID_MARK);
1747       CGAL_assertion(this->cont());
1748 
1749       Dart_handle nd = this->mmap->null_handle;
1750 
1751       for ( int k=0; k<2; ++k )
1752       {
1753         if ( this->is_unmarked((*this), k, mmark_number) )
1754         {
1755           if (nd == this->mmap->null_handle)
1756           {
1757             nd = this->mmap->beta(*this, k);
1758             CGAL_assertion(nd!=this->mmap->null_dart_handle);
1759             this->mprev_op = OP_BETAI;
1760           }
1761           else
1762           {
1763             mto_treat.push(this->mmap->beta(*this, k));
1764           }
1765           this->mmap->mark(this->mmap->beta(*this, k), mmark_number);
1766         }
1767       }
1768 
1769       for ( int k=2; k<=d; ++k )
1770       {
1771         if ( k!=i-1 && k!=i && k!=i+1 &&
1772              this->is_unmarked((*this), k, mmark_number) )
1773         {
1774           if (nd == this->mmap->null_handle)
1775           {
1776             nd = this->mmap->beta(*this, k);
1777             CGAL_assertion(nd!=this->mmap->null_dart_handle);
1778             this->mprev_op = OP_BETAI;
1779           }
1780           else
1781           {
1782             mto_treat.push(this->mmap->beta(*this, k));
1783           }
1784           this->mmap->mark(this->mmap->beta(*this, k), mmark_number);
1785         }
1786       }
1787 
1788       if (nd == this->mmap->null_handle)
1789       {
1790         if (!mto_treat.empty())
1791         {
1792           nd = mto_treat.front();
1793           mto_treat.pop();
1794           this->mprev_op = OP_POP;
1795         }
1796         else
1797         {
1798           this->mprev_op = OP_END;
1799         }
1800       }
1801 
1802       this->set_current_dart(nd);
1803       return *this;
1804     }
1805 
1806     /// Postfix ++ operator.
1807     Self operator++(int)
1808     { Self res=*this; operator ++(); return res; }
1809 
1810   protected:
1811     /// Queue of darts to process.
1812     std::queue<Dart_handle> mto_treat;
1813 
1814     /// Index of the used mark.
1815     size_type mmark_number;
1816   };
1817   //****************************************************************************
1818   // i-involution iterator in combinatorial map of dimension d,
1819   // 2<i<=Map::dimension. Iterate by using all beta between 0 and d,
1820   // except beta(i-1), betai and beta(i+1), by inversing order between
1821   // beta0 and beta1
1822   template<typename Map_,int i,int d=Map_::dimension,bool Const=false>
1823   class CMap_dart_iterator_basic_of_involution_inv:
1824     public CMap_dart_iterator<Map_,Const>
1825   {
1826   public:
1827     typedef CMap_dart_iterator_basic_of_involution_inv<Map_,i,d,Const> Self;
1828     typedef CMap_dart_iterator<Map_,Const> Base;
1829 
1830     typedef typename Base::Dart_handle Dart_handle;
1831     typedef typename Base::Map Map;
1832     typedef typename Map::size_type size_type;
1833 
1834     typedef Tag_true Use_mark;
1835 
1836     /// True iff this iterator is basic
1837     typedef Tag_true Basic_iterator;
1838 
1839   public:
1840     /// Main constructor.
CMap_dart_iterator_basic_of_involution_inv(Map & amap,Dart_handle adart,size_type amark)1841     CMap_dart_iterator_basic_of_involution_inv(Map& amap,
1842                                                Dart_handle adart,
1843                                                size_type amark):
1844       Base(amap, adart),
1845       mmark_number(amark)
1846     {
1847       CGAL_assertion( i>=3 && i<=Map::dimension );
1848       if (adart!=this->mmap->null_handle)
1849       {
1850         this->mmap->mark(adart, mmark_number);
1851         this->mmap->mark_null_dart(mmark_number);
1852       }
1853     }
1854 
1855     /// Rewind of the iterator to its beginning.
rewind()1856     void rewind()
1857     {
1858       CGAL_assertion(mmark_number != Map::INVALID_MARK);
1859       Base::rewind();
1860       mto_treat = std::queue<Dart_handle>();
1861       this->mmap->mark((*this), mmark_number);
1862       this->mmap->mark_null_dart(mmark_number);
1863     }
1864 
1865     /// Prefix ++ operator.
1866     Self& operator++()
1867     {
1868       CGAL_assertion(mmark_number != Map::INVALID_MARK);
1869       CGAL_assertion(this->cont());
1870 
1871       Dart_handle nd = this->mmap->null_handle;
1872 
1873       for ( int k=1; k>=0; --k )
1874       {
1875         if ( this->is_unmarked((*this), k, mmark_number) )
1876         {
1877           if (nd == this->mmap->null_handle)
1878           {
1879             nd = this->mmap->beta(*this, k);
1880             CGAL_assertion(nd!=this->mmap->null_dart_handle);
1881             this->mprev_op = OP_BETAI;
1882           }
1883           else
1884           {
1885             mto_treat.push(this->mmap->beta(*this, k));
1886           }
1887           this->mmap->mark(this->mmap->beta(*this, k), mmark_number);
1888         }
1889       }
1890       for ( int k=2; k<=d; ++k )
1891       {
1892         if ( k!=i-1 && k!=i && k!=i+1 &&
1893              this->is_unmarked((*this), k, mmark_number) )
1894         {
1895           if (nd == this->mmap->null_handle)
1896           {
1897             nd = this->mmap->beta(*this, k);
1898             CGAL_assertion(nd!=this->mmap->null_dart_handle);
1899             this->mprev_op = OP_BETAI;
1900           }
1901           else
1902           {
1903             mto_treat.push(this->mmap->beta(*this, k));
1904           }
1905           this->mmap->mark(this->mmap->beta(*this, k), mmark_number);
1906         }
1907       }
1908 
1909       if (nd == this->mmap->null_handle)
1910       {
1911         if (!mto_treat.empty())
1912         {
1913           nd = mto_treat.front();
1914           mto_treat.pop();
1915           this->mprev_op = OP_POP;
1916         }
1917         else
1918         {
1919           this->mprev_op = OP_END;
1920         }
1921       }
1922 
1923       this->set_current_dart(nd);
1924       return *this;
1925     }
1926 
1927     /// Postfix ++ operator.
1928     Self operator++(int)
1929     { Self res=*this; operator ++(); return res; }
1930 
1931   protected:
1932     /// Queue of darts to process.
1933     std::queue<Dart_handle> mto_treat;
1934 
1935     /// Index of the used mark.
1936     size_type mmark_number;
1937   };
1938   //****************************************************************************
1939   // 1-involution iterator in combinatorial map of dimension d.
1940   // Iterate by using all beta between 3 and d.
1941   template<typename Map_,int d,bool Const>
1942   class CMap_dart_iterator_basic_of_involution<Map_,1,d,Const>:
1943     public CMap_dart_iterator<Map_,Const>
1944   {
1945   public:
1946     typedef CMap_dart_iterator_basic_of_involution<Map_,1,d,Const> Self;
1947     typedef CMap_dart_iterator<Map_,Const> Base;
1948 
1949     typedef typename Base::Dart_handle Dart_handle;
1950     typedef typename Base::Map Map;
1951     typedef typename Map::size_type size_type;
1952 
1953     typedef Tag_true Use_mark;
1954 
1955     /// True iff this iterator is basic
1956     typedef Tag_true Basic_iterator;
1957 
1958   public:
1959     /// Main constructor.
CMap_dart_iterator_basic_of_involution(Map & amap,Dart_handle adart,size_type amark)1960     CMap_dart_iterator_basic_of_involution(Map& amap,
1961                                            Dart_handle adart,
1962                                            size_type amark):
1963       Base(amap, adart),
1964       mmark_number(amark)
1965     { if (adart!=this->mmap->null_handle)
1966       {
1967         this->mmap->mark(adart, mmark_number);
1968         this->mmap->mark_null_dart(mmark_number);
1969       }
1970     }
1971 
1972     /// Rewind of the iterator to its beginning.
rewind()1973     void rewind()
1974     {
1975       CGAL_assertion(mmark_number != Map::INVALID_MARK);
1976       Base::rewind();
1977       mto_treat = std::queue<Dart_handle>();
1978       this->mmap->mark_null_dart(mmark_number);
1979       this->mmap->mark((*this), mmark_number);
1980     }
1981 
1982     /// Prefix ++ operator.
1983     Self& operator++()
1984     {
1985       CGAL_assertion(mmark_number != Map::INVALID_MARK);
1986       CGAL_assertion(this->cont());
1987 
1988       Dart_handle nd = this->mmap->null_handle;
1989 
1990       for ( unsigned int k=3; k<=d; ++k )
1991       {
1992         if ( this->is_unmarked((*this), k, mmark_number) )
1993         {
1994           if (nd == this->mmap->null_handle)
1995           {
1996             nd = this->mmap->beta(*this, k);
1997             CGAL_assertion(nd!=this->mmap->null_dart_handle);
1998             this->mprev_op = OP_BETAI;
1999           }
2000           else
2001           {
2002             mto_treat.push(this->mmap->beta(*this, k));
2003           }
2004           this->mmap->mark(this->mmap->beta(*this, k), mmark_number);
2005         }
2006       }
2007 
2008       if (nd == this->mmap->null_handle)
2009       {
2010         if (!mto_treat.empty())
2011         {
2012           nd = mto_treat.front();
2013           mto_treat.pop();
2014           this->mprev_op = OP_POP;
2015         }
2016         else
2017         {
2018           this->mprev_op = OP_END;
2019         }
2020       }
2021 
2022       this->set_current_dart(nd);
2023       return *this;
2024     }
2025 
2026     /// Postfix ++ operator.
2027     Self operator++(int)
2028     { Self res=*this; operator ++(); return res; }
2029 
2030   protected:
2031     /// Queue of darts to process.
2032     std::queue<Dart_handle> mto_treat;
2033 
2034     /// Index of the used mark.
2035     size_type mmark_number;
2036   };
2037   //****************************************************************************
2038   // 1-involution iterator in combinatorial map of dimension d.
2039   // Iterate by using all beta between 3 and d.
2040   template<typename Map_,int d,bool Const>
2041   class CMap_dart_iterator_basic_of_involution_inv<Map_,1,d,Const>:
2042     public CMap_dart_iterator_basic_of_involution<Map_,1,d,Const>
2043   {
2044   public:
2045     typedef CMap_dart_iterator_basic_of_involution_inv<Map_,1,d,Const> Self;
2046     typedef CMap_dart_iterator_basic_of_involution<Map_,1,d,Const> Base;
2047 
2048     typedef typename Base::Dart_handle Dart_handle;
2049     typedef typename Base::Map Map;
2050     typedef typename Map::size_type size_type;
2051 
2052     typedef Tag_true Use_mark;
2053 
2054     /// True iff this iterator is basic
2055     typedef Tag_true Basic_iterator;
2056 
2057   public:
2058     /// Main constructor.
CMap_dart_iterator_basic_of_involution_inv(Map & amap,Dart_handle adart,size_type amark)2059     CMap_dart_iterator_basic_of_involution_inv(Map& amap,
2060                                                Dart_handle adart,
2061                                                size_type amark):
2062       Base(amap, adart,amark)
2063     {}
2064   };
2065   //****************************************************************************
2066   // 2-involution iterator in combinatorial map of dimension d.
2067   // Iterate by using all beta between 4 and d.
2068   template<typename Map_,int d,bool Const>
2069   class CMap_dart_iterator_basic_of_involution<Map_,2,d,Const>:
2070     public CMap_dart_iterator<Map_,Const>
2071   {
2072   public:
2073     typedef CMap_dart_iterator_basic_of_involution<Map_,2,d,Const> Self;
2074     typedef CMap_dart_iterator<Map_,Const> Base;
2075 
2076     typedef typename Base::Dart_handle Dart_handle;
2077     typedef typename Base::Map Map;
2078     typedef typename Map::size_type size_type;
2079 
2080     typedef Tag_true Use_mark;
2081 
2082     /// True iff this iterator is basic
2083     typedef Tag_true Basic_iterator;
2084 
2085   public:
2086     /// Main constructor.
CMap_dart_iterator_basic_of_involution(Map & amap,Dart_handle adart,size_type amark)2087     CMap_dart_iterator_basic_of_involution(Map& amap,
2088                                            Dart_handle adart,
2089                                            size_type amark):
2090       Base(amap, adart),
2091       mmark_number(amark)
2092     { if ( adart!=this->mmap->null_handle)
2093       {
2094         this->mmap->mark(adart, mmark_number);
2095         this->mmap->mark_null_dart(mmark_number);
2096       }
2097     }
2098 
2099     /// Rewind of the iterator to its beginning.
rewind()2100     void rewind()
2101     {
2102       CGAL_assertion(mmark_number != Map::INVALID_MARK);
2103       Base::rewind();
2104       mto_treat = std::queue<Dart_handle>();
2105       this->mmap->mark((*this), mmark_number);
2106       this->mmap->mark_null_dart(mmark_number);
2107     }
2108 
2109     /// Prefix ++ operator.
2110     Self& operator++()
2111     {
2112       CGAL_assertion(mmark_number != Map::INVALID_MARK);
2113       CGAL_assertion(this->cont());
2114 
2115       Dart_handle nd = this->mmap->null_handle;
2116 
2117       for ( unsigned int k=4; k<=d; ++k )
2118       {
2119         if ( this->is_unmarked((*this), k, mmark_number) )
2120         {
2121           if (nd == this->mmap->null_handle)
2122           {
2123             nd = this->mmap->beta(*this, k);
2124             CGAL_assertion(nd!=this->mmap->null_dart_handle);
2125             this->mprev_op = OP_BETAI;
2126           }
2127           else
2128           {
2129             mto_treat.push(this->mmap->beta(*this, k));
2130           }
2131           this->mmap->mark(this->mmap->beta(*this, k), mmark_number);
2132         }
2133       }
2134 
2135       if (nd == this->mmap->null_handle)
2136       {
2137         if (!mto_treat.empty())
2138         {
2139           nd = mto_treat.front();
2140           mto_treat.pop();
2141           this->mprev_op = OP_POP;
2142         }
2143         else
2144         {
2145           this->mprev_op = OP_END;
2146         }
2147       }
2148 
2149       this->set_current_dart(nd);
2150       return *this;
2151     }
2152 
2153     /// Postfix ++ operator.
2154     Self operator++(int)
2155     { Self res=*this; operator ++(); return res; }
2156 
2157   protected:
2158     /// Queue of darts to process.
2159     std::queue<Dart_handle> mto_treat;
2160 
2161     /// Index of the used mark.
2162     size_type mmark_number;
2163   };
2164   //****************************************************************************
2165   // 2-involution iterator in combinatorial map of dimension d.
2166   // Iterate by using all beta between 4 and d.
2167   template<typename Map_,int d,bool Const>
2168   class CMap_dart_iterator_basic_of_involution_inv<Map_,2,d,Const>:
2169     public CMap_dart_iterator_basic_of_involution<Map_,2,d,Const>
2170   {
2171   public:
2172     typedef CMap_dart_iterator_basic_of_involution_inv<Map_,2,d,Const> Self;
2173     typedef CMap_dart_iterator_basic_of_involution<Map_,2,d,Const> Base;
2174 
2175     typedef typename Base::Dart_handle Dart_handle;
2176     typedef typename Base::Map Map;
2177     typedef typename Map::size_type size_type;
2178 
2179     typedef Tag_true Use_mark;
2180 
2181     /// True iff this iterator is basic
2182     typedef Tag_true Basic_iterator;
2183 
2184   public:
2185     /// Main constructor.
CMap_dart_iterator_basic_of_involution_inv(Map & amap,Dart_handle adart,size_type amark)2186     CMap_dart_iterator_basic_of_involution_inv(Map& amap,
2187                                                Dart_handle adart,
2188                                                size_type amark):
2189       Base(amap, adart,amark)
2190     {}
2191   };
2192   //****************************************************************************
2193   // 1-involution iterator in combinatorial map of dimension 2.
2194   // Empty iterator.
2195   template<typename Map_,bool Const>
2196   class CMap_dart_iterator_basic_of_involution<Map_,1,2,Const>:
2197     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const>
2198   {
2199   public:
2200     typedef CMap_dart_iterator_basic_of_involution<Map_,1,2,Const> Self;
2201     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const> Base;
2202 
2203     typedef typename Base::Dart_handle Dart_handle;
2204     typedef typename Base::Map Map;
2205     typedef typename Map::size_type size_type;
2206 
2207     typedef Tag_false Use_mark;
2208 
2209     /// True iff this iterator is basic
2210     typedef Tag_true Basic_iterator;
2211 
2212   public:
2213     /// Main constructor.
CMap_dart_iterator_basic_of_involution(Map & amap,Dart_handle adart,size_type)2214     CMap_dart_iterator_basic_of_involution(Map& amap,
2215                                            Dart_handle adart,
2216                                            size_type /*amark*/):
2217       Base(amap, adart)
2218     {}
2219     /// Main constructor.
CMap_dart_iterator_basic_of_involution(Map & amap,Dart_handle adart)2220     CMap_dart_iterator_basic_of_involution(Map& amap,
2221                                            Dart_handle adart):
2222       Base(amap, adart)
2223     {}
2224   };
2225   //****************************************************************************
2226   // 1-involution iterator in combinatorial map of dimension 2.
2227   // self iterator.
2228   template<typename Map_,bool Const>
2229   class CMap_dart_iterator_basic_of_involution_inv<Map_,1,2,Const>:
2230     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const>
2231   {
2232   public:
2233     typedef CMap_dart_iterator_basic_of_involution_inv<Map_,1,2,Const> Self;
2234     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const> Base;
2235 
2236     typedef typename Base::Dart_handle Dart_handle;
2237     typedef typename Base::Map Map;
2238     typedef typename Map::size_type size_type;
2239 
2240     typedef Tag_false Use_mark;
2241 
2242     /// True iff this iterator is basic
2243     typedef Tag_true Basic_iterator;
2244 
2245   public:
2246     /// Main constructor.
CMap_dart_iterator_basic_of_involution_inv(Map & amap,Dart_handle adart,size_type)2247     CMap_dart_iterator_basic_of_involution_inv(Map& amap,
2248                                                Dart_handle adart,
2249                                                size_type /*amark*/):
2250       Base(amap, adart)
2251     {}
2252     /// Main constructor.
CMap_dart_iterator_basic_of_involution_inv(Map & amap,Dart_handle adart)2253     CMap_dart_iterator_basic_of_involution_inv(Map& amap,
2254                                                Dart_handle adart):
2255       Base(amap, adart)
2256     {}
2257   };
2258   //****************************************************************************
2259   // 2-involution iterator in combinatorial map of dimension 2.
2260   // self iterator.
2261   template<typename Map_,bool Const>
2262   class CMap_dart_iterator_basic_of_involution<Map_,2,2,Const>:
2263     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const>
2264   {
2265   public:
2266     typedef CMap_dart_iterator_basic_of_involution<Map_,2,2,Const> Self;
2267     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const> Base;
2268 
2269     typedef typename Base::Dart_handle Dart_handle;
2270     typedef typename Base::Map Map;
2271     typedef typename Map::size_type size_type;
2272 
2273     typedef Tag_false Use_mark;
2274 
2275     /// True iff this iterator is basic
2276     typedef Tag_true Basic_iterator;
2277 
2278   public:
2279     /// Main constructor.
CMap_dart_iterator_basic_of_involution(Map & amap,Dart_handle adart,size_type)2280     CMap_dart_iterator_basic_of_involution(Map& amap,
2281                                            Dart_handle adart,
2282                                            size_type /*amark*/):
2283       Base(amap, adart)
2284     {}
2285     /// Main constructor.
CMap_dart_iterator_basic_of_involution(Map & amap,Dart_handle adart)2286     CMap_dart_iterator_basic_of_involution(Map& amap,
2287                                            Dart_handle adart):
2288       Base(amap, adart)
2289     {}
2290   };
2291   //****************************************************************************
2292   // 2-involution iterator in combinatorial map of dimension 2.
2293   // self iterator.
2294   template<typename Map_,bool Const>
2295   class CMap_dart_iterator_basic_of_involution_inv<Map_,2,2,Const>:
2296     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const>
2297   {
2298   public:
2299     typedef CMap_dart_iterator_basic_of_involution_inv<Map_,2,2,Const> Self;
2300     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const> Base;
2301 
2302     typedef typename Base::Dart_handle Dart_handle;
2303     typedef typename Base::Map Map;
2304     typedef typename Map::size_type size_type;
2305 
2306     typedef Tag_false Use_mark;
2307 
2308     /// True iff this iterator is basic
2309     typedef Tag_true Basic_iterator;
2310 
2311   public:
2312     /// Main constructor.
CMap_dart_iterator_basic_of_involution_inv(Map & amap,Dart_handle adart,size_type)2313     CMap_dart_iterator_basic_of_involution_inv(Map& amap,
2314                                                Dart_handle adart,
2315                                                size_type /*amark*/):
2316       Base(amap, adart)
2317     {}
2318     /// Main constructor.
CMap_dart_iterator_basic_of_involution_inv(Map & amap,Dart_handle adart)2319     CMap_dart_iterator_basic_of_involution_inv(Map& amap,
2320                                                Dart_handle adart):
2321       Base(amap, adart)
2322     {}
2323   };
2324   //****************************************************************************
2325   // 1-involution iterator in combinatorial map of dimension 3.
2326   // Beta3 iterator.
2327   template<typename Map_,bool Const>
2328   class CMap_dart_iterator_basic_of_involution<Map_,1,3,Const>:
2329     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,3>
2330   {
2331   public:
2332     typedef CMap_dart_iterator_basic_of_involution<Map_,1,3,Const> Self;
2333     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,3> Base;
2334 
2335     typedef typename Base::Dart_handle Dart_handle;
2336     typedef typename Base::Map Map;
2337     typedef typename Map::size_type size_type;
2338 
2339     typedef Tag_false Use_mark;
2340 
2341     /// True iff this iterator is basic
2342     typedef Tag_true Basic_iterator;
2343 
2344   public:
2345     /// Main constructor.
CMap_dart_iterator_basic_of_involution(Map & amap,Dart_handle adart,size_type)2346     CMap_dart_iterator_basic_of_involution(Map& amap,
2347                                            Dart_handle adart,
2348                                            size_type /*amark*/):
2349       Base(amap, adart)
2350     {}
2351     /// Main constructor.
CMap_dart_iterator_basic_of_involution(Map & amap,Dart_handle adart)2352     CMap_dart_iterator_basic_of_involution(Map& amap,
2353                                            Dart_handle adart):
2354       Base(amap, adart)
2355     {}
2356   };
2357   //****************************************************************************
2358   // 1-involution iterator in combinatorial map of dimension 3.
2359   // Beta3 iterator.
2360   template<typename Map_,bool Const>
2361   class CMap_dart_iterator_basic_of_involution_inv<Map_,1,3,Const>:
2362     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,3>
2363   {
2364   public:
2365     typedef CMap_dart_iterator_basic_of_involution_inv<Map_,1,3,Const> Self;
2366     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,3> Base;
2367 
2368     typedef typename Base::Dart_handle Dart_handle;
2369     typedef typename Base::Map Map;
2370     typedef typename Map::size_type size_type;
2371 
2372     typedef Tag_false Use_mark;
2373 
2374     /// True iff this iterator is basic
2375     typedef Tag_true Basic_iterator;
2376 
2377   public:
2378     /// Main constructor.
CMap_dart_iterator_basic_of_involution_inv(Map & amap,Dart_handle adart,size_type)2379     CMap_dart_iterator_basic_of_involution_inv(Map& amap,
2380                                                Dart_handle adart,
2381                                                size_type /*amark*/):
2382       Base(amap, adart)
2383     {}
2384     /// Main constructor.
CMap_dart_iterator_basic_of_involution_inv(Map & amap,Dart_handle adart)2385     CMap_dart_iterator_basic_of_involution_inv(Map& amap,
2386                                                Dart_handle adart):
2387       Base(amap, adart)
2388     {}
2389   };
2390   //****************************************************************************
2391   // 2-involution iterator in combinatorial map of dimension 3.
2392   // Self iterator.
2393   template<typename Map_,bool Const>
2394   class CMap_dart_iterator_basic_of_involution<Map_,2,3,Const>:
2395     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const>
2396   {
2397   public:
2398     typedef CMap_dart_iterator_basic_of_involution<Map_,2,3,Const> Self;
2399     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const> Base;
2400 
2401     typedef typename Base::Dart_handle Dart_handle;
2402     typedef typename Base::Map Map;
2403     typedef typename Map::size_type size_type;
2404 
2405     typedef Tag_false Use_mark;
2406 
2407     /// True iff this iterator is basic
2408     typedef Tag_true Basic_iterator;
2409 
2410   public:
2411     /// Main constructor.
CMap_dart_iterator_basic_of_involution(Map & amap,Dart_handle adart,size_type)2412     CMap_dart_iterator_basic_of_involution(Map& amap,
2413                                            Dart_handle adart,
2414                                            size_type /* amark*/):
2415       Base(amap, adart)
2416     {}
2417     /// Main constructor.
CMap_dart_iterator_basic_of_involution(Map & amap,Dart_handle adart)2418     CMap_dart_iterator_basic_of_involution(Map& amap,
2419                                            Dart_handle adart):
2420       Base(amap, adart)
2421     {}
2422   };
2423   //****************************************************************************
2424   // 2-involution iterator in combinatorial map of dimension 3.
2425   // Self iterator.
2426   template<typename Map_,bool Const>
2427   class CMap_dart_iterator_basic_of_involution_inv<Map_,2,3,Const>:
2428     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const>
2429   {
2430   public:
2431     typedef CMap_dart_iterator_basic_of_involution_inv<Map_,2,3,Const> Self;
2432     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const> Base;
2433 
2434     typedef typename Base::Dart_handle Dart_handle;
2435     typedef typename Base::Map Map;
2436     typedef typename Map::size_type size_type;
2437 
2438     typedef Tag_false Use_mark;
2439 
2440     /// True iff this iterator is basic
2441     typedef Tag_true Basic_iterator;
2442 
2443   public:
2444     /// Main constructor.
CMap_dart_iterator_basic_of_involution_inv(Map & amap,Dart_handle adart,size_type)2445     CMap_dart_iterator_basic_of_involution_inv(Map& amap,
2446                                                Dart_handle adart,
2447                                                size_type /*amark*/):
2448       Base(amap, adart)
2449     {}
2450     /// Main constructor.
CMap_dart_iterator_basic_of_involution_inv(Map & amap,Dart_handle adart)2451     CMap_dart_iterator_basic_of_involution_inv(Map& amap,
2452                                                Dart_handle adart):
2453       Base(amap, adart)
2454     {}
2455   };
2456   //****************************************************************************
2457   // 1-involution iterator in combinatorial map of dimension 3.
2458   // Beta1 iterator.
2459   template<typename Map_,bool Const>
2460   class CMap_dart_iterator_basic_of_involution<Map_,3,3,Const>:
2461     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1>
2462   {
2463   public:
2464     typedef CMap_dart_iterator_basic_of_involution<Map_,3,3,Const> Self;
2465     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,1> Base;
2466 
2467     typedef typename Base::Dart_handle Dart_handle;
2468     typedef typename Base::Map Map;
2469     typedef typename Map::size_type size_type;
2470 
2471     typedef Tag_false Use_mark;
2472 
2473     /// True iff this iterator is basic
2474     typedef Tag_true Basic_iterator;
2475 
2476   public:
2477     /// Main constructor.
CMap_dart_iterator_basic_of_involution(Map & amap,Dart_handle adart,size_type)2478     CMap_dart_iterator_basic_of_involution(Map& amap,
2479                                            Dart_handle adart,
2480                                            size_type /*amark*/):
2481       Base(amap, adart)
2482     {}
2483     /// Main constructor.
CMap_dart_iterator_basic_of_involution(Map & amap,Dart_handle adart)2484     CMap_dart_iterator_basic_of_involution(Map& amap,
2485                                            Dart_handle adart):
2486       Base(amap, adart)
2487     {}
2488   };
2489   //****************************************************************************
2490   // 1-involution iterator in combinatorial map of dimension 3.
2491   // Beta0 iterator.
2492   template<typename Map_,bool Const>
2493   class CMap_dart_iterator_basic_of_involution_inv<Map_,3,3,Const>:
2494     public CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,0>
2495   {
2496   public:
2497     typedef CMap_dart_iterator_basic_of_involution_inv<Map_,3,3,Const> Self;
2498     typedef CMap_dart_iterator_basic_of_orbit_generic<Map_,Const,0> Base;
2499 
2500     typedef typename Base::Dart_handle Dart_handle;
2501     typedef typename Base::Map Map;
2502     typedef typename Map::size_type size_type;
2503 
2504     typedef Tag_false Use_mark;
2505 
2506     /// True iff this iterator is basic
2507     typedef Tag_true Basic_iterator;
2508 
2509   public:
2510     /// Main constructor.
CMap_dart_iterator_basic_of_involution_inv(Map & amap,Dart_handle adart,size_type)2511     CMap_dart_iterator_basic_of_involution_inv(Map& amap,
2512                                                Dart_handle adart,
2513                                                size_type /*amark*/):
2514       Base(amap, adart)
2515     {}
2516     /// Main constructor.
CMap_dart_iterator_basic_of_involution_inv(Map & amap,Dart_handle adart)2517     CMap_dart_iterator_basic_of_involution_inv(Map& amap,
2518                                                Dart_handle adart):
2519       Base(amap, adart)
2520     {}
2521   };
2522   //****************************************************************************
2523   template<typename Map_,int i,int d=Map_::dimension,bool Const=false>
2524   class CMap_dart_iterator_of_involution:
2525     public CMap_non_basic_iterator<Map_,
2526                                    CMap_dart_iterator_basic_of_involution
2527                                    <Map_,i,d,Const> >
2528   {
2529   public:
2530     typedef CMap_dart_iterator_of_involution<Map_,i,d,Const> Self;
2531     typedef CMap_non_basic_iterator<Map_,
2532                                     CMap_dart_iterator_basic_of_involution
2533                                     <Map_,i,d,Const> >  Base;
2534 
2535     /// Main constructor.
CMap_dart_iterator_of_involution(typename Base::Map & amap,typename Base::Dart_handle adart1)2536     CMap_dart_iterator_of_involution(typename Base::Map& amap,
2537                                      typename Base::Dart_handle adart1):
2538       Base(amap, adart1)
2539     {}
2540   };
2541   //****************************************************************************
2542   template<typename Map_,int i,int d=Map_::dimension,bool Const=false>
2543   class CMap_dart_iterator_of_involution_inv:
2544     public CMap_non_basic_iterator<Map_,
2545                                    CMap_dart_iterator_basic_of_involution_inv
2546                                    <Map_,i,d,Const> >
2547   {
2548   public:
2549     typedef CMap_dart_iterator_of_involution_inv<Map_,i,d,Const> Self;
2550     typedef CMap_non_basic_iterator<Map_,
2551                                     CMap_dart_iterator_basic_of_involution_inv
2552                                     <Map_,i,d,Const> >  Base;
2553 
2554     /// Main constructor.
CMap_dart_iterator_of_involution_inv(typename Base::Map & amap,typename Base::Dart_handle adart1)2555     CMap_dart_iterator_of_involution_inv(typename Base::Map& amap,
2556                                          typename Base::Dart_handle adart1):
2557       Base(amap, adart1)
2558     {}
2559   };
2560   //****************************************************************************
2561 } // namespace CGAL
2562 //******************************************************************************
2563 #endif // CGAL_DART_ITERATORS_HH
2564 //******************************************************************************
2565