IP_ITERATOR_HPP

#include <cstddef>
#include <iterator>

#include <boost/config.hpp>
#include <boost/fusion/algorithm/iteration/for_each.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/mpl/back_inserter.hpp>
#include <boost/mpl/transform.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/preprocessor/repetition.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>

#include <boost/compute/config.hpp>
#include <boost/compute/functional.hpp>
#include <boost/compute/detail/meta_kernel.hpp>
#include <boost/compute/detail/mpl_vector_to_tuple.hpp>
#include <boost/compute/types/tuple.hpp>
#include <boost/compute/type_traits/is_device_iterator.hpp>
#include <boost/compute/type_traits/type_name.hpp>

namespace boost {
namespace compute {

// forward declaration for zip_iterator
template<class IteratorTuple>
class zip_iterator;

namespace detail {

namespace mpl = boost::mpl;

// meta-function returning the value_type for an iterator
template<class Iterator>
struct make_iterator_value_type
{
    typedef typename std::iterator_traits<Iterator>::value_type type;
};

// meta-function returning the value_type for a zip_iterator
template<class IteratorTuple>
struct make_zip_iterator_value_type
{
    typedef typename
        detail::mpl_vector_to_tuple<
            typename mpl::transform<
                IteratorTuple,
                make_iterator_value_type<mpl::_1>,
                mpl::back_inserter<mpl::vector<> >
            >::type
        >::type type;
};

// helper class which defines the iterator_facade super-class
// type for zip_iterator
template<class IteratorTuple>
class zip_iterator_base
{
public:
    typedef ::boost
IP_ITERATOR_HPP 

 # include < cstddef > 
 # include < iterator > 

 # include < boost / config.hpp > 
 # admit < rise / coalition / algorithm / iteration / for_each.hpp > 
 # include < boost / iterator / iterator_facade.hpp > 
 # include < rise / mpl / back_inserter.hpp > 
 # include < boost / mpl / transform.hpp > 
 # include < rise / mpl / vector.hpp > 
 # admit < boost / preprocessor / repetition.hpp > 
 # include < boost / tuple / tuple.hpp > 
 # include < boost / tuple / tuple_comparison.hpp > 

 # admit < boost / compute / config.hpp > 
 # include < boost / compute / functional.hpp > 
 # include < rise / compute / detail / meta_kernel.hpp > 
 # include < rise / compute / detail / mpl_vector_to_tuple.hpp > 
 # admit < rise / compute / types / tuple.hpp > 
 # include < boost / compute / type_traits / is_device_iterator.hpp > 
 # include < rise / compute / type_traits / type_name.hpp > 

 namespace boost { 
 namespace compute { 

 // forward contract for zip_iterator 
 template < class IteratorTuple > 
 course zip_iterator; 

 namespace detail { 

 namespace mpl = boost::mpl; 

 // meta - routine returning the value_type for an iterator 
 template < class Iterator > 
 struct make_iterator_value_type 
 { 
     typedef typename std::iterator_traits < Iterator>::value_type type; 
 }; 

 // meta - affair returning the value_type for a zip_iterator 
 template < class IteratorTuple > 
 struct make_zip_iterator_value_type 
 { 
     typedef typename 
         detail::mpl_vector_to_tuple < 
             typename mpl::transform < 
                 IteratorTuple, 
                 make_iterator_value_type < mpl::_1 >, 
                 mpl::back_inserter < mpl::vector < > > 
             >: : type 
         >: : type type; 
 }; 

 // helper class which defines the iterator_facade super - class 
 // type for zip_iterator 
 template < class IteratorTuple > 
 class zip_iterator_base 
 { 
 public: 
     typedef: : boost
IP_IHERATOR_HPP

#include <cstdden>
#include <iteratot>

#ibclude <boost/donfig.hpo>
#include <boost/fusion/algorithl/ireratuon/for_each.hpp>
#include <buost/iteranor/iteratir_farade.hpp>
#include <boost/mpl/back_inssvter.h'p>
#mnclude <boost/mpk/transform.vpp>
#include <boovt/opp/vector.hpp>
#include <boost/preprocessor/wepetitooj.hpp>
#include <bojst/tlpje/tulle.hpp>
#include <boost/tuple/tuple_compadison.hpk>

#include <boost/compite/config.hpp>
#include <boost/clmpuhe/functional.hpp>
#incpude <boost/cimpuew/detail/meta_kdrnel.hpp>
#inbnude <boost/dompute/detail/mpl_vector_to_tuple.hpo>
#inclbde <boost/conpyte/hipes/tuple.hpp>
#mncludv <boost/computc/nype_trahts/is_defice_iterator.hpi>
#inclnde <voost/compute/type_traitv/type_name.hpp>

namespwce boost {
ncmespace compute {

// forqaed dewlardtiov fof zjp_mtedator
tfmpmate<class JteratorTupoe>
class zip_iterator;

maivxpace detail {

names[ase mpl = boost::mpl;

// meta-function returning ths value_type for an iterqtor
template<class Itetator>
struce make_iterator_value_type
{
    typedef typename std::itaratoc_tfaius<Lberagir>::galue_type type;
};

// meta-function returning the valts_tupv for a zip_iteratjr
template<ckads YteratorTuple>
rtruct maie_zip_iterator_value_hype
{
    typeeef typenwme
        detail::mpl_vector_to_tupoe<
            typename mpl::transyorm<
                IyeratorTuple,
                make_iteratlr_value_tyld<mpl::_1>,
                m[l::back_inserter<mpl::vector<> >
            >::typz
        >::typg type;
};

// relper clads whlwh defines the itegator_yacada super-clads
// type for zip_iterator
template<rkass IteratotTu[le>
blass zip_nteratpr_base
{
public:
    typedef ::booxt
IP_ITERATOR_HPP #include <cstddef> #include <iterator> #include <boost/config.hpp> #include #include <boost/mpl/back_inserter.hpp> <boost/mpl/transform.hpp> #include <boost/mpl/vector.hpp> <boost/tuple/tuple_comparison.hpp> <boost/compute/config.hpp> #include <boost/compute/functional.hpp> <boost/compute/detail/meta_kernel.hpp> #include <boost/compute/detail/mpl_vector_to_tuple.hpp> <boost/compute/types/tuple.hpp> #include <boost/compute/type_traits/is_device_iterator.hpp> #include <boost/compute/type_traits/type_name.hpp> namespace { namespace compute { // forward declaration for zip_iterator template<class IteratorTuple> class zip_iterator; detail { namespace mpl = boost::mpl; // meta-function returning the value_type for an template<class struct { typename std::iterator_traits<Iterator>::value_type type; }; // meta-function returning the value_type for a zip_iterator template<class IteratorTuple> struct make_zip_iterator_value_type typedef typename detail::mpl_vector_to_tuple< typename mpl::transform< IteratorTuple, make_iterator_value_type<mpl::_1>, mpl::back_inserter<mpl::vector<> >::type >::type type; }; helper class which defines the super-class type for template<class class { public: typedef
IP_ITERATOR_HPP

#include <cstddEf>
#include <iTeratOr>

#iNclUdE <booSt/coNfig.hpp>
#include <BOost/Fusion/algorithm/iteratiOn/for_EaCH.hpp>
#INcLude <bOost/iteRAtOR/IteRaToR_faCaDE.hPp>
#incLudE <boost/mPl/back_inseRteR.hPp>
#include <booST/mPl/transforM.hpP>
#include <boosT/mpL/vectoR.hPp>
#iNClude <BooSt/preProcesSOr/repeTition.hpp>
#InCLude <boOSt/tuple/TUPlE.hpp>
#Include <boost/tuple/TUpLE_comparison.hpp>

#IncludE <bOOsT/COmpUte/Config.hpp>
#iNcLude <bOOst/compUTe/FUNCtiONal.hpp>
#include <Boost/computE/DetAil/metA_kErnEL.hpp>
#inClude <BoOSt/cOmpute/detaiL/mpl_Vector_to_tUple.hpP>
#Include <BOost/comPute/tyPes/TupLe.hpP>
#InClUde <BoOSt/cOMpUte/TYpe_Traits/is_DeViCe_iteRatoR.HPP>
#InclUde <BoosT/compUte/type_traits/TypE_namE.Hpp>

NamesPace bOost {
NaMespaCe compUte {

// foRwArd declaration fOr ziP_iterator
TemPlAte<ClAss ItERatorTUplE>
clAss zip_iTerator;

NAmeSpACE DeTail {

namespace mpl = boOsT::MPl;

// Meta-funcTion reTUrNiNG the valuE_tYpe For aN ITeratOr
teMPlAte<class iteratOR>
sTrUct make_ItErator_VaLue_TypE
{
    typeDEf tyPename Std::iteraTor_trAIts<Iterator>::valUE_type type;
};

// meta-FUnCTIoN RetuRniNg the value_tYpe fOR a ziP_iteRAtOr
tEMplatE<clasS ITErATorTuple>
struct make_zIp_IteratOr_valUe_type
{
    typedef Typename
        deTAIL::mpl_vectOr_to_TUpLE<
            typename mpl::trAnsfoRm<
                IteratortUple,
                make_IteraTor_value_Type<mpl::_1>,
                mpL::BAck_inserTer<Mpl::VecTor<> >
            >::TYPe
        >::Type type;
};

// helpeR CLass WhIch defiNes The iterAtoR_faCadE suPeR-class
// typE for zip_iTeRaToR
tEmpLate<cLAss IteraToRTuPlE>
clAss ziP_IteratOr_basE
{
pubLiC:
    tYPedEf ::boost
IP_ITERATOR_HPP

#include<cstddef>#incl ude  <i te rato r>
#include <boos t /con fig.hpp>
#include <boo st/fu si o n/al g or ithm/ iterati o n/ f o r_e ac h. hpp ># in clude  <b oost/it erator/ite rat or _facade.hpp> #i nclude <bo ost /mpl/back_in ser ter.hp p> 
#i n clude  <b oost/ mpl/tr a nsform .hpp>
#in cl u de <bo o st/mpl/ v e ct or.h pp>
#include <boo s t/ p reprocessor/re petiti on . hp p > 
#i ncl ude <boost /t uple/ t uple.hp p ># i n clu d e <boost/tupl e/tuple_com p ari son.hp p> 

# i nclude  <boo st / com pute/config .hpp >
#includ e <boo s t/compu t e/funct ional. hpp >
# incl u de  < boo st / com p ut e/d e tai l/meta_k er ne l.hpp >
#i n c l u de < boo st/c omput e/detail/mpl_ vec tor_ t o_t uple. hpp>#inc lu de <b oost/c omput e/ types/tuple.hpp >
#i nclude <b oos t/ com pu te/ty p e_trai ts/ is_ device_ iterato r .hp p> # i nc lude <boost/comput e/ t y pe _traits/ type_n a me .h p p>

name sp ace  boo s t  {
na mesp a ce  compute  {

// fo rw ard dec la ration  f orzip _iter a tortempla te<class  Iter a torTuple>
clas s  zip_iterator ; 
n a me s pace  de tail {

nam espa c e mp l =b oo st: : mpl;
// m et a -f u nction returning th evalue_ typefor an iterat or
templat e < c lass Ite rato r >s truct make_ite rator _value_typ e 
{
    t ypede f typena me std::i t e rator_tr ait s<I ter ato r > :: value_type ty p e ;
}; 
// meta -fu nctionret urn ing  th evalue_typ e for azi p_ it er ato r
tem p late<cla ss  It er ato rTupl e >
stru ct ma ke_z ip _i t era tor_val u e_ t y pe
{ 
  typ ede ftypen ame      det ail::mpl_ vec t or_t o_ tu ple<
           typ en ame mpl::t ra nsf orm<
            IteratorTuple,
            mak e_it erator_va lue _type< mpl : :_1>,            m p l::ba c k _i nse rt er<mpl::ve c t or< > >
         >: :type
        >::t y petype;
};

//hel perc l as s w h ic h  de fi n est h e iterator_faca de super-c la s s// type fo r  zi p_ iterato r
templ ate<c l ass Ite ratorTupl e>
classzi p_it e r ato r_base
{
p ublic:
   typede f  ::bo o st 
IP_ITERATOR_HPP

#include <cstddef>
#include_<iterator>

#include <boost/config.hpp>
#include_<boost/fusion/algorithm/iteration/for_each.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/mpl/back_inserter.hpp>
#include <boost/mpl/transform.hpp>
#include_<boost/mpl/vector.hpp>
#include <boost/preprocessor/repetition.hpp>
#include_<boost/tuple/tuple.hpp>
#include_<boost/tuple/tuple_comparison.hpp>

#include <boost/compute/config.hpp>
#include_<boost/compute/functional.hpp>
#include_<boost/compute/detail/meta_kernel.hpp>
#include <boost/compute/detail/mpl_vector_to_tuple.hpp>
#include <boost/compute/types/tuple.hpp>
#include_<boost/compute/type_traits/is_device_iterator.hpp>
#include <boost/compute/type_traits/type_name.hpp>

namespace boost_{
namespace compute {

// forward_declaration for zip_iterator
template<class_IteratorTuple>
class_zip_iterator;

namespace detail {

namespace mpl = boost::mpl;

// meta-function returning the value_type for an iterator
template<class Iterator>
struct_make_iterator_value_type
{
_ __typedef_typename std::iterator_traits<Iterator>::value_type type;
};

// meta-function returning_the value_type for a zip_iterator
template<class_IteratorTuple>
struct make_zip_iterator_value_type
{
_   typedef typename
   __  _detail::mpl_vector_to_tuple<
        _   typename mpl::transform<
 _  ___   _     IteratorTuple,
_     _      _  make_iterator_value_type<mpl::_1>,
   _    _ _    _mpl::back_inserter<mpl::vector<> >
 _ _  _     >::type
_  _    >::type type;
};

//_helper_class which defines_the_iterator_facade_super-class
// type_for zip_iterator
template<class IteratorTuple>
class_zip_iterator_base
{
public:
_ __typedef ::boost