BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/iterator.h
Go to the documentation of this file.
00001 // Copyright (c) 2003  Utrecht University (The Netherlands),
00002 // ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
00003 // INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
00004 // (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
00005 // and Tel-Aviv University (Israel).  All rights reserved.
00006 //
00007 // This file is part of CGAL (www.cgal.org); you can redistribute it and/or
00008 // modify it under the terms of the GNU Lesser General Public License as
00009 // published by the Free Software Foundation; version 2.1 of the License.
00010 // See the file LICENSE.LGPL distributed with CGAL.
00011 //
00012 // Licensees holding a valid commercial license may use this file in
00013 // accordance with the commercial license agreement provided with the software.
00014 //
00015 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00016 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00017 //
00018 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/STL_Extension/include/CGAL/iterator.h $
00019 // $Id: iterator.h 50386 2009-07-06 09:30:22Z afabri $
00020 // 
00021 //
00022 // Author(s)     : Michael Hoffmann <hoffmann@inf.ethz.ch>
00023 //                 Lutz Kettner <kettner@mpi-sb.mpg.de>
00024 //                 Sylvain Pion
00025 
00026 #ifndef CGAL_ITERATOR_H
00027 #define CGAL_ITERATOR_H 1
00028 
00029 #include <CGAL/circulator.h>
00030 #include <vector>
00031 #include <map>
00032 #include <boost/type_traits.hpp>
00033 #include <CGAL/tuple.h>
00034 
00035 #if defined(BOOST_MSVC)
00036 #  pragma warning(push)
00037 #  pragma warning(disable:4396)
00038 #endif
00039 CGAL_BEGIN_NAMESPACE
00040 
00041 // +----------------------------------------------------------------+
00042 // | Emptyset_iterator
00043 // +----------------------------------------------------------------+
00044 // |  sends everything to /dev/null
00045 // +----------------------------------------------------------------+
00046 
00047 struct Emptyset_iterator
00048   : public std::iterator< std::output_iterator_tag, void, void, void, void >
00049 {
00050   template< class T >
00051   Emptyset_iterator& operator=(const T&) { return *this; }
00052 
00053   Emptyset_iterator& operator++()        { return *this; }
00054   Emptyset_iterator& operator++(int)     { return *this; }
00055 
00056   Emptyset_iterator& operator*()         { return *this; }
00057 };
00058 
00059 // +---------------------------------------------------------------------+
00060 // | Insert_iterator
00061 // +---------------------------------------------------------------------+
00062 // | Insert output iterator, which calls insert(value) on the container.
00063 // | Similar to std::insert_iterator<> except it doesn't pass an iterator.
00064 // +---------------------------------------------------------------------+
00065 
00066 template < class Container >
00067 class Insert_iterator
00068   : public std::iterator< std::output_iterator_tag, void, void, void, void >
00069 {
00070 protected:
00071   Container *container;
00072 public:
00073   typedef Container container_type;
00074 
00075   explicit Insert_iterator(Container &c)
00076   : container(&c) {}
00077 
00078   Insert_iterator&
00079   operator=(typename Container::const_reference value)
00080   {
00081     container->insert(value);
00082     return *this;
00083   }
00084 
00085   Insert_iterator&
00086   operator*() { return *this; }
00087 
00088   Insert_iterator&
00089   operator++() { return *this; }
00090 
00091   Insert_iterator
00092   operator++(int) { return *this; }
00093 };
00094 
00095 template < class Container >
00096 inline Insert_iterator<Container>
00097 inserter(Container &x)
00098 { return Insert_iterator<Container>(x); }
00099 
00100 // +----------------------------------------------------------------+
00101 // | Oneset_iterator
00102 // +----------------------------------------------------------------+
00103 // |  stores a pointer to an object of type T
00104 // |  which will be affected by operator*().
00105 // +----------------------------------------------------------------+
00106 
00107 template < class T >
00108 class Oneset_iterator
00109   : public std::iterator< std::bidirectional_iterator_tag,
00110                           void, void, void, void >
00111 {
00112   T* t;
00113   
00114 public:
00115   // types
00116   typedef Oneset_iterator<T> Self;
00117   
00118 public:
00119   Oneset_iterator(T& t) : t(&t) {}
00120 
00121   T&       operator*()        { return *t; }
00122   const T& operator*()  const { return *t; }
00123   T*       operator->()       { return t; }
00124   const T* operator->() const { return t; }
00125 
00126   Self&    operator++()       { return *this; }
00127   Self&    operator++(int)    { return *this; }
00128 
00129   Self&    operator--()       { return *this; }
00130   Self&    operator--(int)    { return *this; }
00131 };
00132 
00133 // +----------------------------------------------------------------+
00134 // | Const_oneset_iterator
00135 // +----------------------------------------------------------------+
00136 // |  stores an object of type T
00137 // |  which will be affected by operator*().
00138 // +----------------------------------------------------------------+
00139 
00140 template < typename T >
00141 class Const_oneset_iterator {
00142 public:
00143   
00144   // types
00145   typedef  std::random_access_iterator_tag    iterator_category;
00146   typedef  std::ptrdiff_t                     difference_type;
00147   typedef  T                                  value_type;
00148   typedef  value_type*                        pointer;
00149   typedef  value_type&                        reference;
00150   
00151   typedef  Const_oneset_iterator<T>           Self;
00152   typedef  difference_type                    Diff;
00153   typedef  value_type                         Val;
00154   typedef  pointer                            Ptr;
00155   typedef  reference                          Ref;
00156   
00157   // construction
00158   Const_oneset_iterator( const T& t = T(), Diff n = 0)
00159     : value( t), index( n)
00160   { }
00161   
00162   // access
00163   Ref               operator *  ( )       { return  value; }
00164   const value_type& operator *  ( ) const { return  value; }
00165   Ptr               operator -> ( )       { return &value; }
00166   const value_type* operator -> ( ) const { return &value; }
00167   
00168   // equality operator
00169   bool       operator == ( const Self& x) const { return ( index==x.index); }
00170   bool       operator != ( const Self& x) const { return ( index!=x.index); }
00171   
00172   // forward operations
00173   // ------------------
00174   Self&      operator ++ (    ) {                   ++index; return *this; }
00175   Self       operator ++ ( int) { Self tmp = *this; ++index; return tmp;   }
00176   
00177   // bidirectional operations
00178   // ------------------------
00179   Self&      operator -- (    ) {                   --index; return *this; }
00180   Self       operator -- ( int) { Self tmp = *this; --index; return tmp;   }
00181   
00182   // random access operations
00183   // ------------------------
00184   // access
00185   Ref               operator [] ( Diff )       { return value;}
00186   const value_type& operator [] ( Diff ) const { return value;}
00187   
00188   // less operator
00189   bool       operator <  ( const Self& x) const { return ( index < x.index);}
00190   
00191   // arithmetic operations
00192   Self&      operator += ( Diff n) { index += n; return *this; }
00193   Self&      operator -= ( Diff n) { index -= n; return *this; }
00194   
00195   Self       operator +  ( Diff n) const { Self tmp = *this; return tmp+=n; }
00196   Self       operator -  ( Diff n) const { Self tmp = *this; return tmp-=n; }
00197   
00198   Diff       operator -  ( const Self& x) const { return index - x.index; }
00199   
00200 private:
00201   
00202   // data members
00203   Val   value;
00204   Diff  index;
00205 };
00206 
00207 // +----------------------------------------------------------------+
00208 // | Counting_output_iterator
00209 // +----------------------------------------------------------------+
00210 // |  stores a pointer to an int,
00211 // |  which will be incremented by operator=().
00212 // +----------------------------------------------------------------+
00213 
00214 // Undocumented, because there is some hope to merge it into Counting_iterator
00215 class Counting_output_iterator
00216   : public std::iterator< std::output_iterator_tag, void, void, void, void >
00217 {
00218   std::size_t *c;
00219 public:
00220   Counting_output_iterator(std::size_t *cc) : c(cc) { *c = 0; }
00221 
00222   Counting_output_iterator& operator++()    { return *this; }
00223   Counting_output_iterator& operator++(int) { return *this; }
00224 
00225   Counting_output_iterator& operator*() { return *this; }
00226 
00227   template <typename T>
00228   void operator=(const T&) { ++*c; }
00229 
00230   std::size_t current_counter() const { return *c; }
00231 };
00232 
00233 template < class I,
00234            class Val = typename std::iterator_traits<I>::value_type >
00235 class Counting_iterator {
00236 protected:
00237   I            nt;    // The internal iterator.
00238   std::size_t  d_i;   // The internal counter.
00239 public:
00240   typedef I  Iterator;
00241   typedef Counting_iterator<I,Val> Self;
00242 
00243   typedef std::input_iterator_tag  iterator_category;
00244   typedef Val                      value_type;
00245   typedef std::ptrdiff_t           difference_type;
00246   typedef const value_type&        reference;
00247   typedef const value_type*        pointer;
00248 
00249   // CREATION
00250   // --------
00251 
00252   Counting_iterator( std::size_t i = 0)             : d_i(i) {}
00253   Counting_iterator( Iterator j, std::size_t i = 0) : nt(j), d_i(i) {}
00254 
00255   // OPERATIONS Forward Category
00256   // ---------------------------
00257 
00258   Iterator    current_iterator() const { return nt;}
00259   std::size_t current_counter()  const { return d_i;}
00260 
00261   bool operator==( const Self& i) const { return ( d_i == i.d_i); }
00262   bool operator!=( const Self& i) const { return !(*this == i);   }
00263   reference  operator*()  const { return *nt; }
00264   pointer    operator->() const { return nt.operator->(); }
00265   Self& operator++() {
00266     ++nt;
00267     ++d_i;
00268     return *this;
00269   }
00270   Self  operator++(int) {
00271     Self tmp = *this;
00272     ++*this;
00273     return tmp;
00274   }
00275 };
00276 
00277 template < class I, int N,
00278            class Ref  = typename std::iterator_traits<I>::reference,
00279            class Ptr  = typename std::iterator_traits<I>::pointer,
00280            class Val  = typename std::iterator_traits<I>::value_type,
00281            class Dist = typename std::iterator_traits<I>::difference_type,
00282            class Ctg  = typename std::iterator_traits<I>::iterator_category >
00283 class N_step_adaptor {
00284 protected:
00285   I        nt;    // The internal iterator.
00286   bool     empty;
00287 public:
00288   typedef I                                        Iterator;
00289   typedef N_step_adaptor<I,N>                      Self;
00290   typedef std::iterator_traits<I>          ITI;
00291   typedef typename ITI::reference          reference;
00292   typedef typename ITI::pointer            pointer;
00293   typedef typename ITI::value_type         value_type;
00294   typedef typename ITI::difference_type    difference_type;
00295   typedef typename ITI::iterator_category  iterator_category;
00296   // Special for circulators.
00297   typedef I_Circulator_size_traits<iterator_category,I> C_S_Traits;
00298   typedef typename  C_S_Traits::size_type               size_type;
00299 
00300   // CREATION
00301   // --------
00302 
00303   N_step_adaptor(): empty(true) {}
00304   N_step_adaptor( Iterator j) : nt(j), empty(false) {}
00305 
00306   template <class II>
00307   N_step_adaptor( const N_step_adaptor<II,N>& j)
00308     : nt( j.current_iterator()), empty(j.empty) {}
00309 
00310   // OPERATIONS Forward Category
00311   // ---------------------------
00312 
00313   // Circulator stuff.
00314   typedef  I  Circulator;
00315   Circulator  current_circulator() const { return nt;}
00316 
00317   Iterator  current_iterator() const { return nt;}
00318   bool operator==( Nullptr_t p) const {
00319     CGAL_assertion( p == 0);
00320     return empty;
00321   }
00322   bool  operator!=( Nullptr_t p) const { return !(*this == p); }
00323   bool  operator==( const Self& i) const { return (empty && i.empty) ||( nt == i.nt); }
00324   bool  operator!=( const Self& i) const { return !(*this == i); }
00325   reference operator*()  const { return *nt; }
00326   pointer   operator->() const { return nt.operator->(); }
00327   Self& operator++() {
00328     std::advance( nt, N);
00329     return *this;
00330   }
00331   Self  operator++(int) {
00332     Self tmp = *this;
00333     ++*this;
00334     return tmp;
00335   }
00336 
00337   // OPERATIONS Bidirectional Category
00338   // ---------------------------------
00339 
00340   Self& operator--() {
00341     std::advance( nt, -N);
00342     return *this;
00343   }
00344   Self  operator--(int) {
00345     Self tmp = *this;
00346     --*this;
00347     return tmp;
00348   }
00349 
00350   // OPERATIONS Random Access Category
00351   // ---------------------------------
00352 
00353   Self  min_circulator() const { return Self( nt.min_circulator()); }
00354   Self& operator+=( difference_type n) {
00355     nt += difference_type(N * n);
00356     return *this;
00357   }
00358   Self  operator+( difference_type n) const {
00359     Self tmp = *this;
00360     tmp.nt += difference_type(N * n);
00361     return tmp;
00362   }
00363   Self& operator-=( difference_type n) {
00364     return operator+=( -n);
00365   }
00366   Self  operator-( difference_type n) const {
00367     Self tmp = *this;
00368     return tmp += -n;
00369   }
00370   difference_type  operator-( const Self& i) const { return (nt-i.nt)/N;}
00371   reference operator[]( difference_type n) const {
00372     Self tmp = *this;
00373     tmp += n;
00374     return tmp.operator*();
00375   }
00376   bool operator<( const Self& i) const { return ( nt < i.nt); }
00377   bool operator>( const Self& i) const { return i < *this; }
00378   bool operator<=( const Self& i) const { return !(i < *this); }
00379   bool operator>=( const Self& i) const { return !(*this < i); }
00380 };
00381 
00382 // Microsoft 1300 cannot handle the default template parameters. Hence, ...
00383 template < class I, int N, class Ref, class Ptr, 
00384            class Val, class Dist, class Ctg >
00385 inline
00386 N_step_adaptor<I,N,Ref,Ptr,Val,Dist,Ctg>
00387 operator+(typename N_step_adaptor<I,N,Ref,Ptr,Val,Dist,Ctg>::difference_type n,
00388           N_step_adaptor<I,N,Ref,Ptr,Val,Dist,Ctg> i)
00389 { return i += n; }
00390 
00391 template < class I, int N>
00392 class N_step_adaptor_derived : public I {
00393 public:
00394     typedef I                               Iterator;
00395     typedef I                               Circulator;
00396     typedef N_step_adaptor_derived<I,N>     Self;
00397     typedef typename I::iterator_category   iterator_category;
00398     typedef typename I::value_type          value_type;
00399     typedef typename I::difference_type     difference_type;
00400     typedef typename I::reference           reference;
00401     typedef typename I::pointer             pointer;
00402     // Special for circulators.
00403     typedef I_Circulator_size_traits<iterator_category,I> C_S_Traits;
00404     typedef typename  C_S_Traits::size_type               size_type;
00405 
00406 // CREATION
00407 // --------
00408 
00409     N_step_adaptor_derived() {}
00410     N_step_adaptor_derived( Iterator j) : I(j) {}
00411 
00412     template <class II>
00413     N_step_adaptor_derived( const N_step_adaptor_derived<II,N>& j)
00414         : I( j.current_iterator()) {}
00415 
00416 // OPERATIONS Forward Category
00417 // ---------------------------
00418 
00419     Circulator current_circulator() const { return *this;}
00420     Iterator   current_iterator()   const { return *this;}
00421 
00422     Self& operator++() {
00423         std::advance( (I&)*this, N);
00424         return *this;
00425     }
00426     Self  operator++(int) {
00427         Self tmp = *this;
00428         ++*this;
00429         return tmp;
00430     }
00431 
00432 // OPERATIONS Bidirectional Category
00433 // ---------------------------------
00434 
00435     Self& operator--() {
00436         std::advance( (I&)*this, -N);
00437         return *this;
00438     }
00439     Self  operator--(int) {
00440         Self tmp = *this;
00441         --*this;
00442         return tmp;
00443     }
00444 
00445 // OPERATIONS Random Access Category
00446 // ---------------------------------
00447 
00448     Self  min_circulator() const { return Self( I::min_circulator()); }
00449     Self& operator+=( difference_type n) {
00450         I::operator+=( difference_type(N * n));
00451         return *this;
00452     }
00453     Self  operator+( difference_type n) const {
00454         Self tmp = *this;
00455         tmp += n;
00456         return tmp;
00457     }
00458     Self& operator-=( difference_type n) {
00459         return operator+=( -n);
00460     }
00461     Self  operator-( difference_type n) const {
00462         Self tmp = *this;
00463         return tmp += -n;
00464     }
00465     difference_type  operator-( const Self& i) const {
00466         return (I::operator-(i)) / N;
00467     }
00468     reference  operator[]( difference_type n) const {
00469         Self tmp = *this;
00470         tmp += n;
00471         return tmp.operator*();
00472     }
00473 };
00474 
00475 template < class I, int N >
00476 inline
00477 N_step_adaptor_derived<I,N>
00478 operator+( typename N_step_adaptor_derived<I,N>::difference_type n,
00479            N_step_adaptor_derived<I,N> i)
00480 { return i += n; }
00481 
00482 template < class I, class P > struct Filter_iterator;
00483 
00484 template < class I, class P >
00485 bool operator==(const Filter_iterator<I,P>&, const Filter_iterator<I,P>&);
00486 
00487 template < class I, class P >
00488 struct Filter_iterator {
00489   typedef I                                Iterator;
00490   typedef P                                Predicate;
00491   typedef Filter_iterator<I,P>             Self;
00492   typedef std::iterator_traits<I>          ITI;
00493   typedef typename ITI::reference          reference;
00494   typedef typename ITI::pointer            pointer;
00495   typedef typename ITI::value_type         value_type;
00496   typedef typename ITI::difference_type    difference_type;
00497   typedef typename ITI::iterator_category  iterator_category;
00498   // Special for circulators.
00499   typedef I_Circulator_size_traits<iterator_category,I> C_S_Traits;
00500   typedef typename  C_S_Traits::size_type               size_type;
00501 
00502 protected:
00503   Iterator e_;       // past-the-end position.
00504   Iterator c_;       // current position.
00505   Predicate p_;      // Leave out x <==> p_(x).
00506 public:
00507 
00508   Filter_iterator() {}
00509 
00510   Filter_iterator(Iterator e, const Predicate& p)
00511   : e_(e), c_(e), p_(p) {}
00512 
00513   Filter_iterator(Iterator e, const Predicate& p, Iterator c)
00514   : e_(e), c_(c), p_(p)
00515   {
00516     while (c_ != e_ && p_(c_))
00517       ++c_;
00518   }
00519 
00520   Self& operator++() {
00521     do { ++c_; } while (c_ != e_ && p_(c_));
00522     return *this;
00523   }
00524 
00525   Self& operator--() {
00526     do {
00527       --c_;
00528     } while (p_(c_));
00529     return *this;
00530   }
00531 
00532   Self operator++(int) {
00533     Self tmp(*this);
00534     ++(*this);
00535     return tmp;
00536   }
00537 
00538   Self operator--(int) {
00539     Self tmp(*this);
00540     --(*this);
00541     return tmp;
00542   }
00543 
00544   reference operator*() const { return *c_;  }
00545   pointer operator->() const  { return &*c_; }
00546   const Predicate& predicate() const { return p_; }
00547   Iterator base() const { return c_; }
00548 
00549   bool is_end() const { return (c_ == e_); }
00550 
00551   friend bool operator== <>(const Self&, const Self&);
00552 };
00553 
00554 template < class I, class P >
00555 inline Filter_iterator< I, P >
00556 filter_iterator(I e, const P& p)
00557 { return Filter_iterator< I, P >(e, p); }
00558 
00559 template < class I, class P >
00560 inline Filter_iterator< I, P >
00561 filter_iterator(I e, const P& p, I c)
00562 { return Filter_iterator< I, P >(e, p, c); }
00563 
00564 template < class I, class P >
00565 inline
00566 bool operator==(const Filter_iterator<I,P>& it1,
00567                 const Filter_iterator<I,P>& it2)
00568 {
00569   CGAL_precondition(it1.e_ == it2.e_);
00570   return it1.base() == it2.base();
00571 }
00572 
00573 template < class I, class P >
00574 inline
00575 bool operator!=(const Filter_iterator<I,P>& it1,
00576                 const Filter_iterator<I,P>& it2)
00577 { return !(it1 == it2); }
00578 
00579 template <class I1,class Op>
00580 class Join_input_iterator_1 : public 
00581 std::iterator<typename std::iterator_traits<I1>::iterator_category, 
00582               typename Op::result_type, 
00583               typename std::iterator_traits<I1>::difference_type, 
00584               typename Op::result_type*,
00585               typename Op::result_type&>
00586 { 
00587 public: 
00588   typedef Join_input_iterator_1<I1,Op> Self;
00589   typedef typename Op::result_type value_type;
00590   typedef typename std::iterator_traits<I1>::difference_type difference_type; 
00591   typedef value_type* pointer;
00592   typedef value_type& reference; 
00593   
00594 protected:
00595   I1 i1;
00596   Op op;
00597   mutable value_type val;  // Note: mutable is needed because we want to
00598                            // return a reference in operator*() and
00599                            // operator[](int) below.
00600 
00601 public:
00602   Join_input_iterator_1() {}
00603   Join_input_iterator_1(const Join_input_iterator_1& it)
00604     : i1(it.i1), op(it.op) {}
00605   Join_input_iterator_1(I1 i,const Op& o=Op())
00606     : i1(i), op(o) {}
00607   
00608   I1 current_iterator1() const { return i1; }
00609   
00610   bool operator==(const Self& i) const {
00611     return i1 == i.i1;
00612   }
00613   bool operator!=(const Self& i) const { return !(*this == i); }
00614   bool operator< (const Self& i) const {
00615     return i1 < i.i1;
00616   }
00617 
00618   Join_input_iterator_1& operator=(const Join_input_iterator_1& it)
00619   {
00620     i1 = it.i1;
00621     op = it.op;
00622     return *this;
00623   }
00624   
00625   const value_type& operator*() const { 
00626     val = op(*i1);
00627     return val;
00628   }
00629   
00630   Self& operator++(   ) {
00631     ++i1;
00632     return *this;
00633   }
00634   Self  operator++(int) { Self tmp = *this; ++(*this); return tmp; }
00635   Self& operator--(   ) {
00636     --i1;
00637     return *this;
00638   }
00639   Self  operator--(int) { Self tmp = *this; --(*this); return tmp; }
00640   
00641   const value_type& operator[](difference_type i) const {
00642     val = op(i1[i]);
00643     return val;
00644   }
00645   
00646   Self& operator+=(difference_type n) {
00647     i1 += n;
00648     return *this;
00649   }
00650   Self& operator-=(difference_type n) {
00651     i1 -= n;
00652     return *this;
00653   }
00654   Self  operator+ (difference_type n) const {
00655     Self tmp = *this;
00656     return tmp += n;
00657   }
00658   Self  operator- (difference_type n) const {
00659     Self tmp = *this;
00660     return tmp -= n;
00661   }
00662   difference_type operator-(const Self& i) const { return i1 - i.i1; }
00663 };
00664 
00665 template <class I1,class I2,class Op>
00666 class Join_input_iterator_2 : public 
00667 std::iterator<typename std::iterator_traits<I1>::iterator_category, 
00668               typename Op::result_type, 
00669               typename std::iterator_traits<I1>::difference_type, 
00670               typename Op::result_type*,
00671               typename Op::result_type&>
00672 { 
00673 public: 
00674   typedef Join_input_iterator_2<I1,I2,Op> Self;
00675   typedef typename Op::result_type value_type;
00676   typedef typename std::iterator_traits<I1>::difference_type difference_type; 
00677   typedef value_type* pointer;
00678   typedef value_type& reference; 
00679   
00680 protected:
00681   I1 i1;
00682   I2 i2;
00683   Op op;
00684   mutable value_type val;  // Note: mutable is needed because we want to
00685                            // return a reference in operator*() and
00686                            // operator[](int) below.
00687   
00688 public:
00689   Join_input_iterator_2() {}
00690   Join_input_iterator_2(const Join_input_iterator_2& it)
00691     : i1(it.i1), i2(it.i2), op(it.op) {}
00692   Join_input_iterator_2(I1 i1,I2 i2,const Op& op=Op())
00693     : i1(i1), i2(i2), op(op) {}
00694   
00695   I1 current_iterator1() const { return i1; }
00696   I2 current_iterator2() const { return i2; }
00697   
00698   bool operator==(const Self& i) const {
00699     return i1 == i.i1 && i2 == i.i2;
00700   }
00701   bool operator!=(const Self& i) const { return !(*this == i); }
00702   bool operator< (const Self& i) const {
00703     return i1 < i.i1 && i2 < i.i2;
00704   }
00705   
00706   Join_input_iterator_2& operator=(const Join_input_iterator_2& it)
00707   {
00708     i1 = it.i1;
00709     i2 = it.i2;
00710     op = it.op;
00711     return *this;
00712   }
00713 
00714   const value_type& operator*() const { 
00715     val = op(*i1,*i2);
00716     return val;
00717   }
00718   
00719   Self& operator++(   ) {
00720     ++i1;
00721     ++i2;
00722     return *this;
00723   }
00724   Self  operator++(int) { Self tmp = *this; ++(*this); return tmp; }
00725   Self& operator--(   ) {
00726     --i1;
00727     --i2;
00728     return *this;
00729   }
00730   Self  operator--(int) { Self tmp = *this; --(*this); return tmp; }
00731   
00732   const value_type& operator[](difference_type i) const {
00733     val = op(i1[i],i2[i]);
00734     return val;
00735   }
00736   
00737   Self& operator+=(difference_type n) {
00738     i1 += n;
00739     i2 += n;
00740     return *this;
00741   }
00742   Self& operator-=(difference_type n) {
00743     i1 -= n;
00744     i2 -= n;
00745     return *this;
00746   }
00747   Self  operator+ (difference_type n) const {
00748     Self tmp = *this;
00749     return tmp += n;
00750   }
00751   Self  operator- (difference_type n) const {
00752     Self tmp = *this;
00753     return tmp -= n;
00754   }
00755   difference_type operator-(const Self& i) const { return i1 - i.i1; }
00756 };
00757 
00758 template <class I1,class I2,class I3,class Op>
00759 class Join_input_iterator_3 : public 
00760 std::iterator<typename std::iterator_traits<I1>::iterator_category, 
00761               typename Op::result_type, 
00762               typename std::iterator_traits<I1>::difference_type, 
00763               typename Op::result_type*,
00764               typename Op::result_type&>
00765 { 
00766 public: 
00767   typedef Join_input_iterator_3<I1,I2,I3,Op> Self;
00768   typedef typename Op::result_type value_type;
00769   typedef typename std::iterator_traits<I1>::difference_type difference_type; 
00770   typedef value_type* pointer;
00771   typedef value_type& reference; 
00772   
00773 protected:
00774   I1 i1;
00775   I2 i2;
00776   I3 i3;
00777   Op op;
00778   mutable value_type val;  // Note: mutable is needed because we want to
00779                            // return a reference in operator*() and
00780                            // operator[](int) below.
00781   
00782 public:
00783   Join_input_iterator_3() {}
00784   Join_input_iterator_3(const Join_input_iterator_3& it)
00785     : i1(it.i1), i2(it.i2), i3(it.i3), op(it.op) {}
00786   Join_input_iterator_3(I1 i1,I2 i2,I3 i3,const Op& op=Op())
00787     : i1(i1), i2(i2), i3(i3), op(op) {}
00788   
00789   I1 current_iterator1() const { return i1; }
00790   I2 current_iterator2() const { return i2; }
00791   I2 current_iterator3() const { return i3; }
00792   
00793   bool operator==(const Self& i) const {
00794     return i1 == i.i1 && i2 == i.i2 && i3 == i.i3;
00795   }
00796   bool operator!=(const Self& i) const { return !(*this == i); }
00797   bool operator< (const Self& i) const {
00798     return i1 < i.i1 && i2 < i.i2 && i3 < i.i3;
00799   }
00800   
00801   Join_input_iterator_3& operator=(const Join_input_iterator_3& it)
00802   {
00803     i1 = it.i1;
00804     i2 = it.i1;
00805     i3 = it.i3;
00806     op = it.op;
00807     return *this;
00808   }
00809 
00810   const value_type& operator*() const { 
00811     val = op(*i1,*i2,*i3);
00812     return val;
00813   }
00814   
00815   Self& operator++(   ) {
00816     ++i1;
00817     ++i2;
00818     ++i3;
00819     return *this;
00820   }
00821   Self  operator++(int) { Self tmp = *this; ++(*this); return tmp; }
00822   Self& operator--(   ) {
00823     --i1;
00824     --i2;
00825     --i3;
00826     return *this;
00827   }
00828   Self  operator--(int) { Self tmp = *this; --(*this); return tmp; }
00829   
00830   const value_type& operator[](difference_type i) const {
00831     val = op(i1[i],i2[i],i3[i]);
00832     return val;
00833   }
00834   
00835   Self& operator+=(difference_type n) {
00836     i1 += n;
00837     i2 += n;
00838     i3 += n;
00839     return *this;
00840   }
00841   Self& operator-=(difference_type n) {
00842     i1 -= n;
00843     i2 -= n;
00844     i3 -= n;
00845     return *this;
00846   }
00847   Self  operator+ (difference_type n) const {
00848     Self tmp = *this;
00849     return tmp += n;
00850   }
00851   Self  operator- (difference_type n) const {
00852     Self tmp = *this;
00853     return tmp -= n;
00854   }
00855   difference_type operator-(const Self& i) const { return i1 - i.i1; }
00856 };
00857 
00858 template < class IC>
00859 class Inverse_index {
00860 
00861   // DEFINITION
00862   //
00863   // The class Inverse_index<IC,T> constructs an inverse index for a
00864   // given range [i,j) of two iterators or circulators of type `IC' with the
00865   // value type `T'. The first element I in the
00866   // range [i,j) has the index 0. Consecutive elements are numbered
00867   // incrementally. The inverse index provides a query for a given iterator
00868   // or circulator k to retrieve its index number. For random access
00869   // iterators or circulators, it is done in constant time by subtracting i.
00870   // For other iterator categories, an STL `map' is used, which results in a
00871   // log j-i query time. A comparison operator `operator<' is needed for
00872   // `T*'.
00873   //
00874   // CREATION
00875 
00876 protected:
00877   typedef std::map< const void*, std::size_t >  Index;
00878   Index   idx;
00879   IC      start;
00880   typedef typename Index::iterator        Index_iterator;
00881   typedef typename Index::const_iterator  Index_const_iterator;
00882   typedef typename Index::value_type      Item;
00883 
00884 protected:
00885   void ini_idx( IC i, const IC& j, std::input_iterator_tag);
00886   void ini_idx( const IC& i, const IC& j, std::forward_iterator_tag){
00887     ini_idx( i, j, std::input_iterator_tag());
00888   }
00889   void ini_idx(const IC& i,const IC& j, std::bidirectional_iterator_tag){
00890     ini_idx( i, j, std::input_iterator_tag());
00891   }
00892   void ini_idx( const IC& i, const IC& j, Forward_circulator_tag) {
00893     ini_idx( i, j, std::input_iterator_tag());
00894   }
00895   void ini_idx( const IC& i, const IC& j, Bidirectional_circulator_tag){
00896     ini_idx( i, j, std::input_iterator_tag());
00897   }
00898   void ini_idx( const IC&, const IC&, std::random_access_iterator_tag){}
00899   void ini_idx( const IC&, const IC&, Random_access_circulator_tag){}
00900 
00901 public:
00902   void init_index( const IC& i, const IC& j) {
00903     typedef typename std::iterator_traits<IC>::iterator_category ICC;
00904     ini_idx( i, j, ICC());
00905   }
00906 
00907 protected:
00908   void push_back( const IC& k, std::input_iterator_tag) {
00909     std::size_t d = idx.size();
00910     idx[ &*k] = d;
00911   }
00912   void push_back( const IC& k, std::forward_iterator_tag){
00913     push_back( k, std::input_iterator_tag());
00914   }
00915   void push_back( const IC& k, std::bidirectional_iterator_tag){
00916     push_back( k, std::input_iterator_tag());
00917   }
00918   void push_back( const IC& k, Forward_circulator_tag){
00919     push_back( k, std::input_iterator_tag());
00920   }
00921   void push_back( const IC& k, Bidirectional_circulator_tag){
00922     push_back( k, std::input_iterator_tag());
00923   }
00924   void push_back( const IC&, std::random_access_iterator_tag){}
00925   void push_back( const IC&, Random_access_circulator_tag){}
00926 
00927 public:
00928   void push_back( const IC& k) {
00929     // adds k at the end of the indices.
00930     typedef typename std::iterator_traits<IC>::iterator_category ICC;
00931     push_back( k, ICC());
00932   }
00933 
00934   std::size_t find( const IC& k, std::random_access_iterator_tag) const {
00935     return std::size_t(k - start);
00936   }
00937   std::size_t find( const IC& k, Random_access_circulator_tag) const {
00938     return std::size_t(k - start);
00939   }
00940   std::size_t find( const IC& k, std::input_iterator_tag) const {
00941     // returns inverse index of k.
00942     Index_const_iterator i = idx.find( &*k);
00943     CGAL_assertion( i != idx.end());
00944     return (*i).second;
00945   }
00946   std::size_t find( const IC& k, std::forward_iterator_tag) const {
00947     return find( k, std::input_iterator_tag());
00948   }
00949   std::size_t find( const IC& k, std::bidirectional_iterator_tag) const {
00950     return find( k, std::input_iterator_tag());
00951   }
00952   std::size_t find( const IC& k, Forward_circulator_tag) const {
00953     return find( k, std::input_iterator_tag());
00954   }
00955   std::size_t find( const IC& k, Bidirectional_circulator_tag) const {
00956     return find( k, std::input_iterator_tag());
00957   }
00958 
00959   typedef IC           iterator;
00960   typedef IC           Circulator;
00961   typedef std::size_t  size_type;
00962 
00963   Inverse_index() : start(IC()) {}
00964   // invalid index.
00965 
00966   Inverse_index( const IC& i) : start(i) {};
00967   // empty inverse index initialized to start at i.
00968 
00969   Inverse_index( const IC& i, const IC& j) : start(i) {
00970     // inverse index initialized with range [i,j).
00971     init_index( i, j);
00972   }
00973 
00974   // OPERATIONS
00975 
00976   std::size_t operator[]( const IC& k) const {
00977     // returns inverse index of k.
00978     typedef typename std::iterator_traits<IC>::iterator_category
00979       category;
00980     return find( k, category());
00981   }
00982 };
00983 
00984 template < class IC>
00985 void
00986 Inverse_index< IC>::ini_idx( IC i, const IC& j, std::input_iterator_tag) {
00987   std::size_t n = 0;
00988   Index_iterator hint = idx.begin();
00989   if ( ! is_empty_range( i, j)) {
00990     do {
00991       hint = idx.insert( hint, Item( &*i, n));
00992       n++;
00993     } while ((++i) != (j));
00994   }
00995 }
00996 
00997 template < class IC>
00998 class Random_access_adaptor {
00999 
01000   // DEFINITION
01001   //
01002   // The class Random_access_adaptor<IC> provides a random access
01003   // for data structures. Either the data structure supports random access
01004   // iterators or circulators where this class maps function calls to the
01005   // iterator or circulator, or a STL `vector' is used to provide the random
01006   // access. The iterator or circulator of the data structure are of type
01007   // `IC'.
01008   //
01009   // CREATION
01010 
01011 protected:
01012   typedef std::vector< IC> Index;
01013   Index   index;
01014   IC      start;
01015 
01016 public:
01017   typedef typename Index::size_type  size_type;
01018 
01019   void init_index( IC i, const IC& j, std::forward_iterator_tag);
01020   void init_index( const IC& i, const IC& j,
01021                    std::bidirectional_iterator_tag){
01022     init_index( i, j, std::forward_iterator_tag());
01023   }
01024   void init_index( const IC& i, const IC&,
01025                    std::random_access_iterator_tag){
01026     start = i;
01027   }
01028   void init_index( const IC& i, const IC& j) {
01029     typedef typename std::iterator_traits<IC>::iterator_category ICC;
01030     init_index( i, j, ICC());
01031   }
01032 
01033 
01034   void reserve( size_type r, std::forward_iterator_tag) {
01035     index.reserve( r);
01036   }
01037   void reserve( size_type r, std::bidirectional_iterator_tag){
01038     reserve( r, std::forward_iterator_tag());
01039   }
01040   void reserve( size_type, std::random_access_iterator_tag){}
01041 
01042 
01043   void push_back( const IC& k, std::forward_iterator_tag) {
01044     index.push_back(k);
01045   }
01046   void push_back( const IC& k, std::bidirectional_iterator_tag){
01047     push_back( k, std::forward_iterator_tag());
01048   }
01049   void push_back( const IC&, std::random_access_iterator_tag){}
01050 
01051 
01052   const IC& find( size_type n, std::forward_iterator_tag) const {
01053     // returns inverse index of k.
01054     CGAL_assertion( n < index.size());
01055     return index[n];
01056   }
01057   const IC& find( size_type n, std::bidirectional_iterator_tag) const {
01058     return find( n, std::forward_iterator_tag());
01059   }
01060   IC  find( size_type n, std::random_access_iterator_tag) const {
01061     return start + n;
01062   }
01063 
01064   typedef IC   iterator;
01065   typedef IC   Circulator;
01066 
01067   Random_access_adaptor() : start(IC()) {}
01068   // invalid index.
01069 
01070   Random_access_adaptor( const IC& i) : start(i) {}
01071   // empty random access index initialized to start at i.
01072 
01073   Random_access_adaptor( const IC& i, const IC& j) : start(i) {
01074     // random access index initialized with range [i,j).
01075     init_index( i, j);
01076   }
01077 
01078   void reserve( size_type r) {
01079     // reserve r entries, if a `vector' is used internally.
01080     typedef typename std::iterator_traits<IC>::iterator_category ICC;
01081     reserve( r, ICC());
01082   }
01083 
01084   // OPERATIONS
01085 
01086   IC  find( size_type n) const {
01087     // returns inverse index of k.
01088     typedef typename std::iterator_traits<IC>::iterator_category ICC;
01089     return find( n, ICC());
01090   }
01091 
01092   IC  operator[]( size_type n) const { return find(n); }
01093 
01094   void push_back( const IC& k) {
01095     // adds k at the end of the indices.
01096     typedef typename std::iterator_traits<IC>::iterator_category ICC;
01097     push_back( k, ICC());
01098   }
01099 };
01100 
01101 template < class IC>
01102 void
01103 Random_access_adaptor< IC>::init_index( IC i, const IC& j,
01104                                         std::forward_iterator_tag) {
01105   if ( ! is_empty_range( i, j)) {
01106     do {
01107       index.push_back( i);
01108     } while ((++i) != (j));
01109   }
01110 }
01111 
01112 template < class IC, class T >
01113 class Random_access_value_adaptor : public Random_access_adaptor<IC> {
01114 public:
01115   typedef typename Random_access_adaptor<IC>::size_type size_type;
01116 
01117   Random_access_value_adaptor() {}
01118   // invalid index.
01119 
01120   Random_access_value_adaptor( const IC& i)
01121   : Random_access_adaptor<IC>(i) {}
01122   // empty random access index initialized to start at i.
01123 
01124   Random_access_value_adaptor( const IC& i, const IC& j)
01125   : Random_access_adaptor<IC>(i,j) {}
01126   // random access index initialized with range [i,j).
01127 
01128   // OPERATIONS
01129 
01130   T& operator[]( size_type n) const {
01131     // returns inverse index of k.
01132     return *(Random_access_adaptor<IC>::operator[](n));
01133   }
01134 };
01135 
01136 template<typename _Iterator, typename Predicate>
01137     class Filter_output_iterator
01138     : public std::iterator<std::output_iterator_tag, void, void, void, void>
01139     {
01140     protected:
01141       _Iterator iterator;
01142       Predicate predicate;
01143 
01144     public:
01145       typedef _Iterator          iterator_type;
01146 
01147       explicit Filter_output_iterator(_Iterator& __x, const Predicate& pred) 
01148         : iterator(__x), predicate(pred) 
01149       {}
01150 
01151       template <typename T>
01152       Filter_output_iterator&
01153       operator=(const T& t)
01154       {
01155         if(! predicate(t))
01156           iterator = t;
01157         return *this;
01158       }
01159 
01160       Filter_output_iterator&
01161       operator*()
01162       { return *this; }
01163 
01164       Filter_output_iterator&
01165       operator++()
01166       { return *this; }
01167 
01168       Filter_output_iterator
01169       operator++(int)
01170       { return *this; }
01171     };
01172 
01173 template < class I, class P >
01174 inline Filter_output_iterator< I, P >
01175 filter_output_iterator(I e, const P& p)
01176 { return Filter_output_iterator< I, P >(e, p); }
01177 
01178 
01179 #ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
01180 
01181 namespace CGALi {
01182 
01183 template < typename D, typename V = cpp0x::tuple<>, typename O = cpp0x::tuple<> >
01184 struct Derivator
01185 {
01186 #ifndef CGAL_CFG_NO_CPP0X_DELETED_AND_DEFAULT_FUNCTIONS
01187   typedef Derivator<D, V, O> Self;
01188   Self& operator=(const Self&) = delete;
01189 #endif
01190 };
01191 
01192 template < typename D, typename V1, typename O1, typename... V, typename... O>
01193 struct Derivator<D, cpp0x::tuple<V1, V...>, cpp0x::tuple<O1, O...> >
01194   : public Derivator<D, cpp0x::tuple<V...>, cpp0x::tuple<O...> >
01195 {
01196   typedef Derivator<D, cpp0x::tuple<V1, V...>, cpp0x::tuple<O1, O...> > Self;
01197   typedef Derivator<D, cpp0x::tuple<V...>, cpp0x::tuple<O...> > Base;
01198 
01199 #ifndef CGAL_CFG_NO_CPP0X_DELETED_AND_DEFAULT_FUNCTIONS
01200   Self& operator=(const Self&) = delete;
01201 #endif
01202 
01203   using Base::operator=;
01204   
01205   D& operator=(const V1& v)
01206   {
01207     * cpp0x::get< D::size - sizeof...(V) - 1 >(static_cast<typename D::Iterator_tuple&>(static_cast<D&>(*this))) ++ = v;
01208     return static_cast<D&>(*this);
01209   }
01210 };
01211 
01212 } // CGALi
01213 
01214 
01215 // OutputIterator which accepts several types in *o++= and dispatches,
01216 // wraps several other outputiterators, and dispatches accordingly.
01217 template < typename V, typename O >
01218 class Dispatch_output_iterator;
01219 
01220 template < typename... V, typename... O >
01221 class Dispatch_output_iterator < cpp0x::tuple<V...>, cpp0x::tuple<O...> >
01222  : private CGALi::Derivator<Dispatch_output_iterator< cpp0x::tuple<V...>, cpp0x::tuple<O...> >, cpp0x::tuple<V...>, cpp0x::tuple<O...> >
01223  , public cpp0x::tuple<O...>
01224 {
01225   static_assert(sizeof...(V) == sizeof...(O),
01226                 "The number of explicit template parameters has to match the number of arguments");
01227 
01228   static const int size = sizeof...(V);
01229 
01230   template <typename D, typename V_, typename O_>
01231   friend class CGALi::Derivator;
01232 
01233 public:
01234 
01235   typedef cpp0x::tuple<O...>               Iterator_tuple;
01236   typedef cpp0x::tuple<V...>               Value_type_tuple;
01237 
01238   typedef std::output_iterator_tag  iterator_category;
01239   typedef void                      value_type;
01240   typedef void                      difference_type;
01241   typedef void                      pointer;
01242   typedef void                      reference;
01243 
01244 private:
01245 
01246   typedef Dispatch_output_iterator Self;
01247   typedef CGALi::Derivator<Self, Value_type_tuple, Iterator_tuple > Base;
01248 
01249 public:
01250 
01251   using Base::operator=;
01252 
01253   Dispatch_output_iterator(O... o) : cpp0x::tuple<O...>(o...) {}
01254 
01255   Self& operator=(const Self& s)
01256   {
01257     static_cast<Iterator_tuple&>(*this) = static_cast<const Iterator_tuple&>(s);
01258     return *this;
01259   }
01260 
01261   Self& operator++() { return *this; }
01262   Self& operator++(int) { return *this; }
01263   Self& operator*() { return *this; }
01264 
01265   const Iterator_tuple& get_iterator_tuple() const { return *this; }
01266 };
01267 
01268 template < typename... V, typename... O>
01269 Dispatch_output_iterator<cpp0x::tuple<V...>, cpp0x::tuple<O...> >
01270 dispatch_output(O... o)
01271 {
01272   return Dispatch_output_iterator<cpp0x::tuple<V...>, cpp0x::tuple<O...> > (o...);
01273 }
01274 
01275 
01276 // Same as Dispatch_output_iterator, but has a dummy *o++= for all other types
01277 // that drops the data (same as Emptyset_iterator).
01278 
01279 template < typename V, typename O >
01280 class Dispatch_or_drop_output_iterator;
01281 
01282 template < typename... V, typename... O >
01283 class Dispatch_or_drop_output_iterator < cpp0x::tuple<V...>, cpp0x::tuple<O...> >
01284  : public Dispatch_output_iterator< cpp0x::tuple<V...>, cpp0x::tuple<O...> >
01285 {
01286   typedef Dispatch_or_drop_output_iterator Self;
01287   typedef Dispatch_output_iterator< cpp0x::tuple<V...>, cpp0x::tuple<O...> > Base;
01288 
01289   template <typename D, typename V_, typename O_>
01290   friend class CGALi::Derivator;
01291 
01292 public:
01293 
01294   Dispatch_or_drop_output_iterator(O... o) : Base(o...) {}
01295 
01296   using Base::operator=;
01297 
01298   Self& operator*() { return *this; }
01299   Self& operator++() { return *this; }
01300   Self& operator++(int) { return *this; }
01301 
01302   template <class T>
01303   Self& operator=(const T&) { return *this; }
01304 };
01305 
01306 
01307 template < typename... V, typename... O>
01308 inline
01309 Dispatch_or_drop_output_iterator<cpp0x::tuple<V...>, cpp0x::tuple<O...> >
01310 dispatch_or_drop_output(O... o)
01311 {
01312   return Dispatch_or_drop_output_iterator<cpp0x::tuple<V...>, cpp0x::tuple<O...> >(o...);
01313 }
01314 
01315 #else
01316 
01317 // Non-variadic version
01318 
01319 template < typename V, typename O >
01320 class Dispatch_output_iterator;
01321 
01322 template < typename V, typename O >
01323 class Dispatch_or_drop_output_iterator;
01324 
01325 
01326 // Version with 1 parameters
01327 template<class V1,class O1>
01328 class Dispatch_output_iterator<cpp0x::tuple<V1>,cpp0x::tuple<O1> >:public cpp0x::tuple<O1>{
01329   typedef Dispatch_output_iterator Self;
01330   
01331 public:
01332   typedef cpp0x::tuple<V1> Value_type_tuple;
01333   typedef cpp0x::tuple<O1> Iterator_tuple;
01334   typedef std::output_iterator_tag iterator_category;
01335   typedef void                     value_type;
01336   typedef void                     difference_type;
01337   typedef void                     pointer;
01338   typedef void                     reference;
01339 
01340 
01341   Self& operator*(){ return *this; }
01342   Self& operator++(){ return *this; } 
01343   Self& operator++(int){ return *this; }  
01344   
01345   Dispatch_output_iterator(O1 out1):Iterator_tuple(out1){}
01346   
01347   Self& operator=(const V1& obj){
01348     *cpp0x::get<0>(static_cast<Iterator_tuple& >(*this))++=obj;
01349     return *this;
01350   }
01351   
01352   Self& operator=(const Self& s){
01353     static_cast< Iterator_tuple& >(*this) = static_cast< const Iterator_tuple& >(s);
01354     return *this;
01355   }
01356   
01357   const Iterator_tuple& get_iterator_tuple() const
01358   { return *this; }
01359   
01360 };
01361 
01362 
01363 template<class V1,class O1>
01364 inline 
01365 Dispatch_output_iterator<cpp0x::tuple<V1>,cpp0x::tuple<O1> >
01366 dispatch_output(O1 out1){
01367   return Dispatch_output_iterator<cpp0x::tuple<V1>,cpp0x::tuple<O1> >(out1);
01368 }
01369 
01370 //Version with DROP
01371 
01372 template<class V1,class O1>
01373 class Dispatch_or_drop_output_iterator<cpp0x::tuple<V1>,cpp0x::tuple<O1> >:
01374         public Dispatch_output_iterator<cpp0x::tuple<V1>,cpp0x::tuple<O1> >
01375 {
01376   typedef Dispatch_or_drop_output_iterator Self;
01377   typedef Dispatch_output_iterator<cpp0x::tuple<V1>,cpp0x::tuple<O1> > Base;
01378   
01379 public:
01380 
01381   Self& operator*(){ return *this; }
01382   Self& operator++(){ return *this; } 
01383   Self& operator++(int){ return *this; }  
01384   
01385   Dispatch_or_drop_output_iterator(O1 out1):Base(out1){}
01386   
01387   #if defined(__EDG__)  
01388   typedef cpp0x::tuple<O1> Iterator_tuple;
01389     
01390   Self& operator=(const V1& obj){
01391     *cpp0x::get<0>(static_cast<Iterator_tuple& >(*this))++=obj;
01392     return *this;
01393   }
01394   
01395   Self& operator=(const Self& s){
01396     static_cast< Iterator_tuple& >(*this) = static_cast< const Iterator_tuple& >(s);
01397     return *this;
01398   }    
01399   #else
01400   using Base::operator=;
01401   #endif //defined(__EDG__)
01402   
01403   
01404   template <class T>
01405   Self& operator=(const T&){
01406     return *this;
01407   }
01408 };
01409 
01410 template<class V1,class O1>
01411 inline 
01412 Dispatch_or_drop_output_iterator<cpp0x::tuple<V1>,cpp0x::tuple<O1> >
01413 dispatch_or_drop_output(O1 out1){
01414   return Dispatch_or_drop_output_iterator<cpp0x::tuple<V1>,cpp0x::tuple<O1> >(out1);
01415 }
01416 
01417 // Version with 2 parameters
01418 template<class V1,class O1,class V2,class O2>
01419 class Dispatch_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> >:public cpp0x::tuple<O1,O2>{
01420   typedef Dispatch_output_iterator Self;
01421   
01422 public:
01423   typedef cpp0x::tuple<V1,V2> Value_type_tuple;
01424   typedef cpp0x::tuple<O1,O2> Iterator_tuple;
01425   typedef std::output_iterator_tag iterator_category;
01426   typedef void                     value_type;
01427   typedef void                     difference_type;
01428   typedef void                     pointer;
01429   typedef void                     reference;
01430 
01431 
01432   Self& operator*(){ return *this; }
01433   Self& operator++(){ return *this; } 
01434   Self& operator++(int){ return *this; }  
01435   
01436   Dispatch_output_iterator(O1 out1,O2 out2):Iterator_tuple(out1,out2){}
01437   
01438   Self& operator=(const V1& obj){
01439     *cpp0x::get<0>(static_cast<Iterator_tuple& >(*this))++=obj;
01440     return *this;
01441   }
01442   
01443   Self& operator=(const V2& obj){
01444     *cpp0x::get<1>(static_cast<Iterator_tuple& >(*this))++=obj;
01445     return *this;
01446   }
01447   
01448   Self& operator=(const Self& s){
01449     static_cast< Iterator_tuple& >(*this) = static_cast< const Iterator_tuple& >(s);
01450     return *this;
01451   }
01452   
01453   const Iterator_tuple& get_iterator_tuple() const
01454   { return *this; }
01455   
01456 };
01457 
01458 
01459 template<class V1,class V2,class O1,class O2>
01460 inline 
01461 Dispatch_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> >
01462 dispatch_output(O1 out1,O2 out2){
01463   return Dispatch_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> >(out1,out2);
01464 }
01465 
01466 //Version with DROP
01467 
01468 template<class V1,class O1,class V2,class O2>
01469 class Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> >:
01470         public Dispatch_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> >
01471 {
01472   typedef Dispatch_or_drop_output_iterator Self;
01473   typedef Dispatch_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> > Base;
01474   
01475 public:
01476 
01477   Self& operator*(){ return *this; }
01478   Self& operator++(){ return *this; } 
01479   Self& operator++(int){ return *this; }  
01480   
01481   Dispatch_or_drop_output_iterator(O1 out1,O2 out2):Base(out1,out2){}
01482   
01483   #if defined(__EDG__)  
01484   typedef cpp0x::tuple<O1,O2> Iterator_tuple;
01485     
01486   Self& operator=(const V1& obj){
01487     *cpp0x::get<0>(static_cast<Iterator_tuple& >(*this))++=obj;
01488     return *this;
01489   }
01490   
01491   Self& operator=(const V2& obj){
01492     *cpp0x::get<1>(static_cast<Iterator_tuple& >(*this))++=obj;
01493     return *this;
01494   }  
01495   
01496   Self& operator=(const Self& s){
01497     static_cast< Iterator_tuple& >(*this) = static_cast< const Iterator_tuple& >(s);
01498     return *this;
01499   }    
01500   #else
01501   using Base::operator=;
01502   #endif //defined(__EDG__)
01503   
01504   
01505   template <class T>
01506   Self& operator=(const T&){
01507     return *this;
01508   }
01509 };
01510 
01511 template<class V1,class V2,class O1,class O2>
01512 inline 
01513 Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> >
01514 dispatch_or_drop_output(O1 out1,O2 out2){
01515   return Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2>,cpp0x::tuple<O1,O2> >(out1,out2);
01516 }
01517 
01518 //Versio with 3 parameters
01519 template<class V1,class O1,class V2,class O2,class V3, class O3>
01520 class Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3>,cpp0x::tuple<O1,O2,O3> >:public cpp0x::tuple<O1,O2,O3>{
01521   typedef Dispatch_output_iterator Self;
01522   
01523 public:
01524   typedef cpp0x::tuple<V1,V2,V3> Value_type_tuple;
01525   typedef cpp0x::tuple<O1,O2,O3> Iterator_tuple;
01526   typedef std::output_iterator_tag iterator_category;
01527   typedef void                     value_type;
01528   typedef void                     difference_type;
01529   typedef void                     pointer;
01530   typedef void                     reference;
01531 
01532 
01533   Self& operator*(){ return *this; }
01534   Self& operator++(){ return *this; } 
01535   Self& operator++(int){ return *this; }  
01536   
01537   Dispatch_output_iterator(O1 out1,O2 out2,O3 out3):Iterator_tuple(out1,out2,out3){}
01538   
01539   Self& operator=(const V1& obj){
01540     *cpp0x::get<0>(static_cast<Iterator_tuple& >(*this))++=obj;
01541     return *this;
01542   }
01543   
01544   Self& operator=(const V2& obj){
01545     *cpp0x::get<1>(static_cast<Iterator_tuple& >(*this))++=obj;
01546     return *this;
01547   }
01548 
01549   Self& operator=(const V3& obj){
01550     *cpp0x::get<2>(static_cast<Iterator_tuple& >(*this))++=obj;
01551     return *this;
01552   }  
01553   
01554   Self& operator=(const Self& s){
01555     static_cast< Iterator_tuple& >(*this) = static_cast< const Iterator_tuple& >(s);
01556     return *this;
01557   }
01558   
01559   const Iterator_tuple& get_iterator_tuple() const
01560   { return *this; }
01561   
01562 };
01563 
01564 
01565 template<class V1,class V2,class V3,class O1,class O2,class O3>
01566 inline 
01567 Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3>,cpp0x::tuple<O1,O2,O3> >
01568 dispatch_output(O1 out1,O2 out2,O3 out3){
01569   return Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3>,cpp0x::tuple<O1,O2,O3> >(out1,out2,out3);
01570 }
01571 
01572 //Version with DROP
01573 template < typename V, typename O >
01574 class Dispatch_or_drop_output_iterator;
01575 
01576 
01577 template<class V1,class O1,class V2,class O2,class V3,class O3>
01578 class Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2,V3>,cpp0x::tuple<O1,O2,O3> >:
01579         public Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3>,cpp0x::tuple<O1,O2,O3> >
01580 {
01581   typedef Dispatch_or_drop_output_iterator Self;
01582   typedef Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3>,cpp0x::tuple<O1,O2,O3> > Base;
01583   
01584 public:
01585 
01586   Self& operator*(){ return *this; }
01587   Self& operator++(){ return *this; } 
01588   Self& operator++(int){ return *this; }  
01589   
01590   Dispatch_or_drop_output_iterator(O1 out1,O2 out2,O3 out3):Base(out1,out2,out3){}
01591   
01592   #if defined(__EDG__)  
01593   typedef cpp0x::tuple<O1,O2,O3> Iterator_tuple;
01594     
01595   Self& operator=(const V1& obj){
01596     *cpp0x::get<0>(static_cast<Iterator_tuple& >(*this))++=obj;
01597     return *this;
01598   }
01599   
01600   Self& operator=(const V2& obj){
01601     *cpp0x::get<1>(static_cast<Iterator_tuple& >(*this))++=obj;
01602     return *this;
01603   }  
01604   
01605   Self& operator=(const V3& obj){
01606     *cpp0x::get<2>(static_cast<Iterator_tuple& >(*this))++=obj;
01607     return *this;
01608   }  
01609   
01610   Self& operator=(const Self& s){
01611     static_cast< Iterator_tuple& >(*this) = static_cast< const Iterator_tuple& >(s);
01612     return *this;
01613   }    
01614   #else
01615   using Base::operator=;
01616   #endif //defined(__EDG__)
01617   
01618   
01619   template <class T>
01620   Self& operator=(const T&){
01621     return *this;
01622   }
01623 };
01624 
01625 template<class V1,class V2,class V3,class O1,class O2,class O3>
01626 inline 
01627 Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2,V3>,cpp0x::tuple<O1,O2,O3> >
01628 dispatch_or_drop_output(O1 out1,O2 out2,O3 out3){
01629   return Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2,V3>,cpp0x::tuple<O1,O2,O3> >(out1,out2,out3);
01630 }
01631 
01632 //Versio with 4 parameters
01633 template<class V1,class O1,class V2,class O2,class V3,class O3,class V4,class O4>
01634 class Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4>,cpp0x::tuple<O1,O2,O3,O4> >:public cpp0x::tuple<O1,O2,O3,O4>{
01635   typedef Dispatch_output_iterator Self;
01636   
01637 public:
01638   typedef cpp0x::tuple<V1,V2,V3,V4> Value_type_tuple;
01639   typedef cpp0x::tuple<O1,O2,O3,O4> Iterator_tuple;
01640   typedef std::output_iterator_tag iterator_category;
01641   typedef void                     value_type;
01642   typedef void                     difference_type;
01643   typedef void                     pointer;
01644   typedef void                     reference;
01645 
01646 
01647   Self& operator*(){ return *this; }
01648   Self& operator++(){ return *this; } 
01649   Self& operator++(int){ return *this; }  
01650   
01651   Dispatch_output_iterator(O1 out1,O2 out2,O3 out3,O4 out4):Iterator_tuple(out1,out2,out3,out4){}
01652   
01653   Self& operator=(const V1& obj){
01654     *cpp0x::get<0>(static_cast<Iterator_tuple& >(*this))++=obj;
01655     return *this;
01656   }
01657   
01658   Self& operator=(const V2& obj){
01659     *cpp0x::get<1>(static_cast<Iterator_tuple& >(*this))++=obj;
01660     return *this;
01661   }
01662 
01663   Self& operator=(const V3& obj){
01664     *cpp0x::get<2>(static_cast<Iterator_tuple& >(*this))++=obj;
01665     return *this;
01666   }  
01667   
01668   Self& operator=(const V4& obj){
01669     *cpp0x::get<3>(static_cast<Iterator_tuple& >(*this))++=obj;
01670     return *this;
01671   }  
01672   
01673   Self& operator=(const Self& s){
01674     static_cast< Iterator_tuple& >(*this) = static_cast< const Iterator_tuple& >(s);
01675     return *this;
01676   }
01677   
01678   const Iterator_tuple& get_iterator_tuple() const
01679   { return *this; }
01680   
01681 };
01682 
01683 
01684 template<class V1,class V2,class V3,class V4,class O1,class O2,class O3,class O4>
01685 inline 
01686 Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4>,cpp0x::tuple<O1,O2,O3,O4> >
01687 dispatch_output(O1 out1,O2 out2,O3 out3,O4 out4){
01688   return Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4>,cpp0x::tuple<O1,O2,O3,O4> >(out1,out2,out3,out4);
01689 }
01690 
01691 //Version with DROP
01692 template < typename V, typename O >
01693 class Dispatch_or_drop_output_iterator;
01694 
01695 
01696 template<class V1,class O1,class V2,class O2,class V3,class O3,class V4,class O4>
01697 class Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2,V3,V4>,cpp0x::tuple<O1,O2,O3,O4> >:
01698         public Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4>,cpp0x::tuple<O1,O2,O3,O4> >
01699 {
01700   typedef Dispatch_or_drop_output_iterator Self;
01701   typedef Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4>,cpp0x::tuple<O1,O2,O3,O4> > Base;
01702   
01703 public:
01704 
01705   Self& operator*(){ return *this; }
01706   Self& operator++(){ return *this; } 
01707   Self& operator++(int){ return *this; }  
01708   
01709   Dispatch_or_drop_output_iterator(O1 out1,O2 out2,O3 out3,O4 out4):Base(out1,out2,out3,out4){}
01710   
01711   #if defined(__EDG__)  
01712   typedef cpp0x::tuple<O1,O2,O3,O4> Iterator_tuple;
01713     
01714   Self& operator=(const V1& obj){
01715     *cpp0x::get<0>(static_cast<Iterator_tuple& >(*this))++=obj;
01716     return *this;
01717   }
01718   
01719   Self& operator=(const V2& obj){
01720     *cpp0x::get<1>(static_cast<Iterator_tuple& >(*this))++=obj;
01721     return *this;
01722   }  
01723   
01724   Self& operator=(const V3& obj){
01725     *cpp0x::get<2>(static_cast<Iterator_tuple& >(*this))++=obj;
01726     return *this;
01727   }  
01728   
01729   Self& operator=(const V4& obj){
01730     *cpp0x::get<3>(static_cast<Iterator_tuple& >(*this))++=obj;
01731     return *this;
01732   }  
01733   
01734   Self& operator=(const Self& s){
01735     static_cast< Iterator_tuple& >(*this) = static_cast< const Iterator_tuple& >(s);
01736     return *this;
01737   }    
01738   #else
01739   using Base::operator=;
01740   #endif //defined(__EDG__)
01741   
01742   
01743   template <class T>
01744   Self& operator=(const T&){
01745     return *this;
01746   }
01747 };
01748 
01749 template<class V1,class V2,class V3,class V4,class O1,class O2,class O3,class O4>
01750 inline 
01751 Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2,V3,V4>,cpp0x::tuple<O1,O2,O3,O4> >
01752 dispatch_or_drop_output(O1 out1,O2 out2,O3 out3,O4 out4){
01753   return Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2,V3,V4>,cpp0x::tuple<O1,O2,O3,O4> >(out1,out2,out3,out4);
01754 }
01755 
01756 //Versio with 5 parameters
01757 template<class V1,class O1,class V2,class O2,class V3,class O3,class V4,class O4,class V5,class O5>
01758 class Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5>,cpp0x::tuple<O1,O2,O3,O4,O5> >:public cpp0x::tuple<O1,O2,O3,O4,O5>{
01759   typedef Dispatch_output_iterator Self;
01760   
01761 public:
01762   typedef cpp0x::tuple<V1,V2,V3,V4,V5> Value_type_tuple;
01763   typedef cpp0x::tuple<O1,O2,O3,O4,O5> Iterator_tuple;
01764   typedef std::output_iterator_tag iterator_category;
01765   typedef void                     value_type;
01766   typedef void                     difference_type;
01767   typedef void                     pointer;
01768   typedef void                     reference;
01769 
01770 
01771   Self& operator*(){ return *this; }
01772   Self& operator++(){ return *this; } 
01773   Self& operator++(int){ return *this; }  
01774   
01775   Dispatch_output_iterator(O1 out1,O2 out2,O3 out3,O4 out4,O5 out5):Iterator_tuple(out1,out2,out3,out4,out5){}
01776   
01777   Self& operator=(const V1& obj){
01778     *cpp0x::get<0>(static_cast<Iterator_tuple& >(*this))++=obj;
01779     return *this;
01780   }
01781   
01782   Self& operator=(const V2& obj){
01783     *cpp0x::get<1>(static_cast<Iterator_tuple& >(*this))++=obj;
01784     return *this;
01785   }
01786 
01787   Self& operator=(const V3& obj){
01788     *cpp0x::get<2>(static_cast<Iterator_tuple& >(*this))++=obj;
01789     return *this;
01790   }  
01791   
01792   Self& operator=(const V4& obj){
01793     *cpp0x::get<3>(static_cast<Iterator_tuple& >(*this))++=obj;
01794     return *this;
01795   }  
01796   
01797   Self& operator=(const V5& obj){
01798     *cpp0x::get<4>(static_cast<Iterator_tuple& >(*this))++=obj;
01799     return *this;
01800   }  
01801   
01802   Self& operator=(const Self& s){
01803     static_cast< Iterator_tuple& >(*this) = static_cast< const Iterator_tuple& >(s);
01804     return *this;
01805   }
01806   
01807   const Iterator_tuple& get_iterator_tuple() const
01808   { return *this; }
01809   
01810 };
01811 
01812 
01813 template<class V1,class V2,class V3,class V4,class V5,class O1,class O2,class O3,class O4,class O5>
01814 inline 
01815 Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5>,cpp0x::tuple<O1,O2,O3,O4,O5> >
01816 dispatch_output(O1 out1,O2 out2,O3 out3,O4 out4,O5 out5){
01817   return Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5>,cpp0x::tuple<O1,O2,O3,O4,O5> >(out1,out2,out3,out4,out5);
01818 }
01819 
01820 //Version with DROP
01821 template < typename V, typename O >
01822 class Dispatch_or_drop_output_iterator;
01823 
01824 
01825 template<class V1,class O1,class V2,class O2,class V3,class O3,class V4,class O4,class V5,class O5>
01826 class Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5>,cpp0x::tuple<O1,O2,O3,O4,O5> >:
01827         public Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5>,cpp0x::tuple<O1,O2,O3,O4,O5> >
01828 {
01829   typedef Dispatch_or_drop_output_iterator Self;
01830   typedef Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5>,cpp0x::tuple<O1,O2,O3,O4,O5> > Base;
01831   
01832 public:
01833 
01834   Self& operator*(){ return *this; }
01835   Self& operator++(){ return *this; } 
01836   Self& operator++(int){ return *this; }  
01837   
01838   Dispatch_or_drop_output_iterator(O1 out1,O2 out2,O3 out3,O4 out4,O5 out5):Base(out1,out2,out3,out4,out5){}
01839   
01840   #if defined(__EDG__)  
01841   typedef cpp0x::tuple<O1,O2,O3,O4,O5> Iterator_tuple;
01842     
01843   Self& operator=(const V1& obj){
01844     *cpp0x::get<0>(static_cast<Iterator_tuple& >(*this))++=obj;
01845     return *this;
01846   }
01847   
01848   Self& operator=(const V2& obj){
01849     *cpp0x::get<1>(static_cast<Iterator_tuple& >(*this))++=obj;
01850     return *this;
01851   }  
01852   
01853   Self& operator=(const V3& obj){
01854     *cpp0x::get<2>(static_cast<Iterator_tuple& >(*this))++=obj;
01855     return *this;
01856   }  
01857   
01858   Self& operator=(const V4& obj){
01859     *cpp0x::get<3>(static_cast<Iterator_tuple& >(*this))++=obj;
01860     return *this;
01861   }  
01862   
01863   Self& operator=(const V5& obj){
01864     *cpp0x::get<4>(static_cast<Iterator_tuple& >(*this))++=obj;
01865     return *this;
01866   }  
01867   
01868   Self& operator=(const Self& s){
01869     static_cast< Iterator_tuple& >(*this) = static_cast< const Iterator_tuple& >(s);
01870     return *this;
01871   }    
01872   #else
01873   using Base::operator=;
01874   #endif //defined(__EDG__)
01875   
01876   
01877   template <class T>
01878   Self& operator=(const T&){
01879     return *this;
01880   }
01881 };
01882 
01883 template<class V1,class V2,class V3,class V4,class V5,class O1,class O2,class O3,class O4,class O5>
01884 inline 
01885 Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5>,cpp0x::tuple<O1,O2,O3,O4,O5> >
01886 dispatch_or_drop_output(O1 out1,O2 out2,O3 out3,O4 out4,O5 out5){
01887   return Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5>,cpp0x::tuple<O1,O2,O3,O4,O5> >(out1,out2,out3,out4,out5);
01888 }
01889 
01890 //Versio with 6 parameters
01891 template<class V1,class O1,class V2,class O2,class V3,class O3,class V4,class O4,class V5,class O5,class V6,class O6>
01892 class Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6>,cpp0x::tuple<O1,O2,O3,O4,O5,O6> >:public cpp0x::tuple<O1,O2,O3,O4,O5,O6>{
01893   typedef Dispatch_output_iterator Self;
01894   
01895 public:
01896   typedef cpp0x::tuple<V1,V2,V3,V4,V5,V6> Value_type_tuple;
01897   typedef cpp0x::tuple<O1,O2,O3,O4,O5,O6> Iterator_tuple;
01898   typedef std::output_iterator_tag iterator_category;
01899   typedef void                     value_type;
01900   typedef void                     difference_type;
01901   typedef void                     pointer;
01902   typedef void                     reference;
01903 
01904 
01905   Self& operator*(){ return *this; }
01906   Self& operator++(){ return *this; } 
01907   Self& operator++(int){ return *this; }  
01908   
01909   Dispatch_output_iterator(O1 out1,O2 out2,O3 out3,O4 out4,O5 out5,O6 out6):Iterator_tuple(out1,out2,out3,out4,out5,out6){}
01910   
01911   Self& operator=(const V1& obj){
01912     *cpp0x::get<0>(static_cast<Iterator_tuple& >(*this))++=obj;
01913     return *this;
01914   }
01915   
01916   Self& operator=(const V2& obj){
01917     *cpp0x::get<1>(static_cast<Iterator_tuple& >(*this))++=obj;
01918     return *this;
01919   }
01920 
01921   Self& operator=(const V3& obj){
01922     *cpp0x::get<2>(static_cast<Iterator_tuple& >(*this))++=obj;
01923     return *this;
01924   }  
01925   
01926   Self& operator=(const V4& obj){
01927     *cpp0x::get<3>(static_cast<Iterator_tuple& >(*this))++=obj;
01928     return *this;
01929   }  
01930   
01931   Self& operator=(const V5& obj){
01932     *cpp0x::get<4>(static_cast<Iterator_tuple& >(*this))++=obj;
01933     return *this;
01934   }  
01935   
01936   Self& operator=(const V6& obj){
01937     *cpp0x::get<5>(static_cast<Iterator_tuple& >(*this))++=obj;
01938     return *this;
01939   }  
01940   
01941   Self& operator=(const Self& s){
01942     static_cast< Iterator_tuple& >(*this) = static_cast< const Iterator_tuple& >(s);
01943     return *this;
01944   }
01945   
01946   const Iterator_tuple& get_iterator_tuple() const
01947   { return *this; }
01948   
01949 };
01950 
01951 
01952 template<class V1,class V2,class V3,class V4,class V5,class V6,class O1,class O2,class O3,class O4,class O5,class O6>
01953 inline 
01954 Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6>,cpp0x::tuple<O1,O2,O3,O4,O5,O6> >
01955 dispatch_output(O1 out1,O2 out2,O3 out3,O4 out4,O5 out5,O6 out6){
01956   return Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6>,cpp0x::tuple<O1,O2,O3,O4,O5,O6> >(out1,out2,out3,out4,out5,out6);
01957 }
01958 
01959 //Version with DROP
01960 template < typename V, typename O >
01961 class Dispatch_or_drop_output_iterator;
01962 
01963 
01964 template<class V1,class O1,class V2,class O2,class V3,class O3,class V4,class O4,class V5,class O5,class V6,class O6>
01965 class Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6>,cpp0x::tuple<O1,O2,O3,O4,O5,O6> >:
01966         public Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6>,cpp0x::tuple<O1,O2,O3,O4,O5,O6> >
01967 {
01968   typedef Dispatch_or_drop_output_iterator Self;
01969   typedef Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6>,cpp0x::tuple<O1,O2,O3,O4,O5,O6> > Base;
01970   
01971 public:
01972 
01973   Self& operator*(){ return *this; }
01974   Self& operator++(){ return *this; } 
01975   Self& operator++(int){ return *this; }  
01976   
01977   Dispatch_or_drop_output_iterator(O1 out1,O2 out2,O3 out3,O4 out4,O5 out5,O6 out6):Base(out1,out2,out3,out4,out5,out6){}
01978   
01979   #if defined(__EDG__)  
01980   typedef cpp0x::tuple<O1,O2,O3,O4,O5,O6> Iterator_tuple;
01981     
01982   Self& operator=(const V1& obj){
01983     *cpp0x::get<0>(static_cast<Iterator_tuple& >(*this))++=obj;
01984     return *this;
01985   }
01986   
01987   Self& operator=(const V2& obj){
01988     *cpp0x::get<1>(static_cast<Iterator_tuple& >(*this))++=obj;
01989     return *this;
01990   }  
01991   
01992   Self& operator=(const V3& obj){
01993     *cpp0x::get<2>(static_cast<Iterator_tuple& >(*this))++=obj;
01994     return *this;
01995   }  
01996   
01997   Self& operator=(const V4& obj){
01998     *cpp0x::get<3>(static_cast<Iterator_tuple& >(*this))++=obj;
01999     return *this;
02000   }  
02001   
02002   Self& operator=(const V5& obj){
02003     *cpp0x::get<4>(static_cast<Iterator_tuple& >(*this))++=obj;
02004     return *this;
02005   }  
02006   
02007   Self& operator=(const V6& obj){
02008     *cpp0x::get<5>(static_cast<Iterator_tuple& >(*this))++=obj;
02009     return *this;
02010   }  
02011   
02012   Self& operator=(const Self& s){
02013     static_cast< Iterator_tuple& >(*this) = static_cast< const Iterator_tuple& >(s);
02014     return *this;
02015   }    
02016   #else
02017   using Base::operator=;
02018   #endif //defined(__EDG__)
02019   
02020   
02021   template <class T>
02022   Self& operator=(const T&){
02023     return *this;
02024   }
02025 };
02026 
02027 template<class V1,class V2,class V3,class V4,class V5,class V6,class O1,class O2,class O3,class O4,class O5,class O6>
02028 inline 
02029 Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6>,cpp0x::tuple<O1,O2,O3,O4,O5,O6> >
02030 dispatch_or_drop_output(O1 out1,O2 out2,O3 out3,O4 out4,O5 out5,O6 out6){
02031   return Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6>,cpp0x::tuple<O1,O2,O3,O4,O5,O6> >(out1,out2,out3,out4,out5,out6);
02032 }
02033 
02034 //Versio with 7 parameters
02035 template<class V1,class O1,class V2,class O2,class V3,class O3,class V4,class O4,class V5,class O5,class V6,class O6,class V7,class O7>
02036 class Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6,V7>,cpp0x::tuple<O1,O2,O3,O4,O5,O6,O7> >:public cpp0x::tuple<O1,O2,O3,O4,O5,O6,O7>{
02037   typedef Dispatch_output_iterator Self;
02038   
02039 public:
02040   typedef cpp0x::tuple<V1,V2,V3,V4,V5,V6,V7> Value_type_tuple;
02041   typedef cpp0x::tuple<O1,O2,O3,O4,O5,O6,O7> Iterator_tuple;
02042   typedef std::output_iterator_tag iterator_category;
02043   typedef void                     value_type;
02044   typedef void                     difference_type;
02045   typedef void                     pointer;
02046   typedef void                     reference;
02047 
02048 
02049   Self& operator*(){ return *this; }
02050   Self& operator++(){ return *this; } 
02051   Self& operator++(int){ return *this; }  
02052   
02053   Dispatch_output_iterator(O1 out1,O2 out2,O3 out3,O4 out4,O5 out5,O6 out6,O7 out7):Iterator_tuple(out1,out2,out3,out4,out5,out6,out7){}
02054   
02055   Self& operator=(const V1& obj){
02056     *cpp0x::get<0>(static_cast<Iterator_tuple& >(*this))++=obj;
02057     return *this;
02058   }
02059   
02060   Self& operator=(const V2& obj){
02061     *cpp0x::get<1>(static_cast<Iterator_tuple& >(*this))++=obj;
02062     return *this;
02063   }
02064 
02065   Self& operator=(const V3& obj){
02066     *cpp0x::get<2>(static_cast<Iterator_tuple& >(*this))++=obj;
02067     return *this;
02068   }  
02069   
02070   Self& operator=(const V4& obj){
02071     *cpp0x::get<3>(static_cast<Iterator_tuple& >(*this))++=obj;
02072     return *this;
02073   }  
02074   
02075   Self& operator=(const V5& obj){
02076     *cpp0x::get<4>(static_cast<Iterator_tuple& >(*this))++=obj;
02077     return *this;
02078   }  
02079   
02080   Self& operator=(const V6& obj){
02081     *cpp0x::get<5>(static_cast<Iterator_tuple& >(*this))++=obj;
02082     return *this;
02083   }  
02084   
02085    Self& operator=(const V7& obj){
02086     *cpp0x::get<6>(static_cast<Iterator_tuple& >(*this))++=obj;
02087     return *this;
02088   }  
02089   
02090   Self& operator=(const Self& s){
02091     static_cast< Iterator_tuple& >(*this) = static_cast< const Iterator_tuple& >(s);
02092     return *this;
02093   }
02094   
02095   const Iterator_tuple& get_iterator_tuple() const
02096   { return *this; }
02097   
02098 };
02099 
02100 
02101 template<class V1,class V2,class V3,class V4,class V5,class V6,class V7,class O1,class O2,class O3,class O4,class O5,class O6,class O7>
02102 inline 
02103 Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6,V7>,cpp0x::tuple<O1,O2,O3,O4,O5,O6,O7> >
02104 dispatch_output(O1 out1,O2 out2,O3 out3,O4 out4,O5 out5,O6 out6,O7 out7){
02105   return Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6,V7>,cpp0x::tuple<O1,O2,O3,O4,O5,O6,O7> >(out1,out2,out3,out4,out5,out6,out7);
02106 }
02107 
02108 //Version with DROP
02109 template < typename V, typename O >
02110 class Dispatch_or_drop_output_iterator;
02111 
02112 
02113 template<class V1,class O1,class V2,class O2,class V3,class O3,class V4,class O4,class V5,class O5,class V6,class O6,class V7,class O7>
02114 class Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6,V7>,cpp0x::tuple<O1,O2,O3,O4,O5,O6,O7> >:
02115         public Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6,V7>,cpp0x::tuple<O1,O2,O3,O4,O5,O6,O7> >
02116 {
02117   typedef Dispatch_or_drop_output_iterator Self;
02118   typedef Dispatch_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6,V7>,cpp0x::tuple<O1,O2,O3,O4,O5,O6,O7> > Base;
02119   
02120 public:
02121 
02122   Self& operator*(){ return *this; }
02123   Self& operator++(){ return *this; } 
02124   Self& operator++(int){ return *this; }  
02125   
02126   Dispatch_or_drop_output_iterator(O1 out1,O2 out2,O3 out3,O4 out4,O5 out5,O6 out6,O7 out7):Base(out1,out2,out3,out4,out5,out6,out7){}
02127   
02128   #if defined(__EDG__)  
02129   typedef cpp0x::tuple<O1,O2,O3,O4,O5,O6,O7> Iterator_tuple;
02130     
02131   Self& operator=(const V1& obj){
02132     *cpp0x::get<0>(static_cast<Iterator_tuple& >(*this))++=obj;
02133     return *this;
02134   }
02135   
02136   Self& operator=(const V2& obj){
02137     *cpp0x::get<1>(static_cast<Iterator_tuple& >(*this))++=obj;
02138     return *this;
02139   }  
02140   
02141   Self& operator=(const V3& obj){
02142     *cpp0x::get<2>(static_cast<Iterator_tuple& >(*this))++=obj;
02143     return *this;
02144   }  
02145   
02146   Self& operator=(const V4& obj){
02147     *cpp0x::get<3>(static_cast<Iterator_tuple& >(*this))++=obj;
02148     return *this;
02149   }  
02150   
02151   Self& operator=(const V5& obj){
02152     *cpp0x::get<4>(static_cast<Iterator_tuple& >(*this))++=obj;
02153     return *this;
02154   }  
02155   
02156   Self& operator=(const V6& obj){
02157     *cpp0x::get<5>(static_cast<Iterator_tuple& >(*this))++=obj;
02158     return *this;
02159   }  
02160 
02161   Self& operator=(const V7& obj){
02162     *cpp0x::get<6>(static_cast<Iterator_tuple& >(*this))++=obj;
02163     return *this;
02164   }  
02165   
02166   Self& operator=(const Self& s){
02167     static_cast< Iterator_tuple& >(*this) = static_cast< const Iterator_tuple& >(s);
02168     return *this;
02169   }    
02170   #else
02171   using Base::operator=;
02172   #endif //defined(__EDG__)
02173   
02174   
02175   template <class T>
02176   Self& operator=(const T&){
02177     return *this;
02178   }
02179 };
02180 
02181 template<class V1,class V2,class V3,class V4,class V5,class V6,class V7,class O1,class O2,class O3,class O4,class O5,class O6,class O7>
02182 inline 
02183 Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6,V7>,cpp0x::tuple<O1,O2,O3,O4,O5,O6,O7> >
02184 dispatch_or_drop_output(O1 out1,O2 out2,O3 out3,O4 out4,O5 out5,O6 out6,O7 out7){
02185   return Dispatch_or_drop_output_iterator<cpp0x::tuple<V1,V2,V3,V4,V5,V6,V7>,cpp0x::tuple<O1,O2,O3,O4,O5,O6,O7> >(out1,out2,out3,out4,out5,out6,out7);
02186 }
02187 
02188 #endif
02189 
02190 CGAL_END_NAMESPACE
02191 
02192 #if defined(BOOST_MSVC)
02193 #  pragma warning(pop)
02194 #endif
02195 
02196 #endif // CGAL_ITERATOR_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines