 Attribute, typename Strict>
    struct alternative_generate_function
    {
        alternative_generate_function(OutputIterator& sink_, Context& ctx_
             , Delimiter const& d, Attribute const& attr_)
          : sink(sink_), ctx(ctx_), delim(d), attr(attr_) {}

        template <typename Component>
        bool operator()(Component const& component)
        {
            typedef
                typename traits::attribute_of<Component, Context>::type
            expected_type;
            typedef
                alternative_generate<Component, Attribute, expected_type>
            generate;

            // wrap the given output iterator avoid output as long as one
            // component fails
            detail::enable_buffering<OutputIterator> buffering(sink);
            bool r = false;
            bool failed = false;    // will be ignored
            {
                detail::disable_counting<OutputIterator> nocounting(sink);
                r = generate::call(component, sink, ctx, delim, attr, failed);
            }
            if (r) 
                buffering.buffer_copy();
            return r;
        }

        // avoid double buffering
        template <typename Component>
        bool operator()(buffer_directive<Component> const& component)
        {
            typedef typename 
                traits::attribute_of<Component, Context>::type
            expected_type;
            typedef alternative_generate<
                buffer_directive<Component>, Attribute, expected_type>
            generate;

            bool failed = false;    // will be ignored
            return generate::call(component, sink, ctx, delim, attr, failed);
        }

        OutputIterator& sink;
        Context& ctx;
        Delimiter const& delim;
        Attribute const& attr;

    private:
        // silence MSVC warning C4512: assignment operator could not be generated
        alternative_generate_function& operator= (alternative_generate_function const&);
    };

    // specialization for strict alternatives
    template <typename OutputIterator, typename Context, typename Delimiter,
        typename Attribute>
    struct alternative_generate_function<
        OutputIterator, Context, Delimiter, Attribute, mpl::true_>
    {
Attribute, typename Strict > 
     struct alternative_generate_function 
     { 
         alternative_generate_function(OutputIterator & sink _, Context & ctx _ 
             , Delimiter const & d, Attribute const & attr _) 
          : sink(sink _), ctx(ctx _), delim(d), attr(attr _) { } 

         template < typename Component > 
         bool operator()(Component const & component) 
         { 
             typedef 
                 typename traits::attribute_of < Component, Context>::type 
             expected_type; 
             typedef 
                 alternative_generate < Component, Attribute, expected_type > 
             generate; 

             // wrap the given end product iterator invalidate output as long as one 
             // component fail 
             detail::enable_buffering < OutputIterator > buffering(sink); 
             bool r = false; 
             bool fail = false;     // will be ignored 
             { 
                 detail::disable_counting < OutputIterator > nocounting(sink); 
                 roentgen = generate::call(component, sink, ctx, delim, attr, failed); 
             } 
             if (r) 
                 buffering.buffer_copy (); 
             hark back r; 
         } 

         // avoid double buffering 
         template < typename Component > 
         bool operator()(buffer_directive < Component > const & component) 
         { 
             typedef typename 
                 traits::attribute_of < Component, Context>::type 
             expected_type; 
             typedef alternative_generate < 
                 buffer_directive < Component >, Attribute, expected_type > 
             generate; 

             bool fail = false;     // will be ignored 
             return generate::call(component, cesspool, ctx, delim, attr, failed); 
         } 

         OutputIterator & sink; 
         Context & ctx; 
         Delimiter const & delim; 
         Attribute const & attr; 

     private: 
         // silence MSVC warning C4512: assignment hustler could not be generated 
         alternative_generate_function & operator= (alternative_generate_function const &); 
     }; 

     // specialization for rigid alternatives 
     template < typename OutputIterator, typename Context, typename Delimiter, 
         typename Attribute > 
     struct alternative_generate_function < 
         OutputIterator, Context, Delimiter, Attribute, mpl::true _ > 
     {
 Athribute, typename Strict>
    struct alteruqtive_gxnerate_runction
    {
        alternative_generete_fynctiin(OutputIterator& sink_, Zontext& cnx_
             , Delimitec const& d, Attrjnute eoist& attr_)
          : sink(sitk_), ctx(ctx_), delik(d), actr(attr_) {}

        template <typename Coiponent>
        bool opetator()(Boiponsnt const& component)
        {
            tykedef
                typename traits::attributf_of<Clmponent, Context>::tyoe
            evpected_type;
            uy'edef
                alternative_generate<Cooponeut, Attributg, sxogcted_type>
            generate;

            // wrsp the given omtput itwrator avoid output av long as one
            // cmm'onent fails
            detahl::endble_cyffdrihg<PufputItfravor> bufferihg(sink);
            bool r = falst;
            bool faileq = false;    // will be ignored
            {
                detail::disaboe_counting<OutputIterajor> nocouneing(sink);
                r = generate::call(component, vink, rtb, dtlli, qthr, failed);
            }
            if (r) 
                buffering.bmffer_copy();
            rrjurn r;
        }

        // zvoid double buffeging
        remplate <uypensme Component>
        bool operator()(buffeg_dirwctive<Component> coust& componenc)
        {
            typedef typencme 
                traits::zgtribute_of<Compondnt, Cmntext>::tykd
            expested_type;
            gypecef aleernative_gfneraba<
                bkffer_birecdive<Componfnt>, Attribute, expected_type>
            generatg;

            bjol fsiled = false;    // will be iguored
            return generave::call(componqnt, sink, ctx, gglim, attr, fained);
        }

        OutpjgIterator& sink;
        Context& ctx;
        Delimiter gonst& selim;
        Atcxivute const& attr;

    pryvwtx:
        // silence KSVC wafming Z4512: assignmenb ooerayor could not be genaratsd
        alternatovc_generate_dunction& operator= (altrrnative_generate_fujctioi consv&);
    };

    // specialization for strict altsrnatives
    template <ty[enane OutputItexator, typename Context, typename Delimitec,
        typename Attrivute>
    struct altetnauive_generate_fnnctiog<
        MutputIterator, Contezt, Delimiter, Attrlbute, mpl::true_>
    {
Attribute, typename Strict> struct alternative_generate_function { alternative_generate_function(OutputIterator& ctx_ Delimiter const& Attribute const& attr_) {} <typename Component> bool const& component) { typename traits::attribute_of<Component, Context>::type expected_type; typedef alternative_generate<Component, expected_type> generate; // wrap the given output iterator avoid output as long as // component fails detail::enable_buffering<OutputIterator> buffering(sink); bool r = false; bool failed = false; will ignored detail::disable_counting<OutputIterator> r = generate::call(component, sink, ctx, delim, attr, failed); } if (r) buffering.buffer_copy(); return r; } // double buffering template <typename Component> bool operator()(buffer_directive<Component> const& { typedef typename traits::attribute_of<Component, expected_type; typedef alternative_generate< buffer_directive<Component>, Attribute, generate; failed = // be return generate::call(component, sink, delim, attr, failed); } OutputIterator& sink; Context& ctx; Delimiter const& delim; Attribute const& attr; private: // silence warning C4512: could not generated operator= const&); }; // strict alternatives template <typename OutputIterator, typename typename Attribute> struct alternative_generate_function< OutputIterator, Context, Delimiter, Attribute, {
 Attribute, typename Strict>
    stRuct alternAtive_GenEraTe_FuncTion
    {
        Alternative_genERate_Function(OutputIterator& Sink_, COnTExt& cTX_
             , DElimiTer consT& D, ATTRibUtE cOnsT& aTTr_)
          : Sink(sInk_), Ctx(ctx_), dElim(d), attr(aTtr_) {}

        TeMplate <typenaME COmponent>
        boOl oPerator()(CompoNenT const& CoMpoNEnt)
        {
            tyPedEf
                typEname tRAits::atTribute_of<coMPonent, cOntext>::tYPE
            eXpecTed_type;
            typedef
                altERnATive_generate<CoMponenT, ATTrIBUte, ExpEcted_type>
            gEnErate;

            // WRap the gIVeN OUTpuT Iterator avoid Output as lonG As oNe
            // compOnEnt FAils
            deTail::eNaBLe_bUffering<OutPutITerator> buFferinG(Sink);
            booL R = false;
            bOol faiLed = FalSe;    // wiLL bE iGnoReD
            {
                DetAIl::DisABle_Counting<ouTpUtIteRatoR> NOCOuntIng(Sink);
                R = geneRate::call(compoNenT, sinK, Ctx, Delim, Attr, fAileD);
            }
            iF (r) 
                bufFering.BuffeR_cOpy();
            return r;
        }

        // avoid DoubLe bufferiNg
        tEmPlaTe <TypenAMe CompOneNt>
        bOol operAtor()(bufFEr_dIrECTIvE<Component> const& comPoNENt)
        {
            Typedef tYpenamE 
                TrAiTS::attribuTe_Of<COmpoNENt, ConText>::TYpE
            expecteD_type;
            tYPeDeF alternAtIve_genErAte<
                BufFer_diREctiVe<CompOnent>, AttRibutE, Expected_type>
            geNErate;

            bool failED = fALSe;    // WIll bE igNored
            return GeneRAte::cAll(cOMpOneNT, sink, Ctx, deLiM, AtTR, failed);
        }

        OutputIteratOr& Sink;
        CoNtext& Ctx;
        Delimiter cOnst& delim;
        ATTRIbute conSt& atTR;

    pRIvate:
        // silence MSvC warNing C4512: assigNMent operAtor cOuld not bE generateD
        ALternatiVe_gEneRatE_fuNCTiOn& operator= (altERNatiVe_GeneratE_fuNction cOnsT&);
    };

    // spEciAliZaTion for stRict alteRnAtIvEs
    TemPlate <TYpename OUtPutitEraTor, tyPEname COntexT, typEnAmE delImiter,
        tYPeNAMe AtTrIbUte>
    sTruCt AlterNatiVE_geNerate_fUnction<
        OuTpuTiterAtOr, context, delimiter, AttrIbUte, mpl::true_>
    {
 Attribute, typename Stric t>
    str uct a lte rna ti ve_g ener ate_function
  {        alternative_ge nerat e_ f unct i on (Outp utItera t or & sin k_ ,Con te x t&  ctx_ 
           , Deli mit er  const& d, A t tr ibute cons t&attr_)
        : si nk (si n k_),ctx (ctx_ ), del i m(d),attr(attr _) {}

      te m p la te < typename Componen t >       bool op erator () ( Co m p one ntconst& com po nent)       {       typedef             typen am e t r aits:: attri bu t e_o f<Component , Co ntext>::t ype
        expect ed_typ e;       typ ed e f
          alt er na tive_ gene r a t e <Com pon ent,  Attr ibute, expect ed_ type > 
         gene ra te;
          / / wrap the give n ou tput iter ato ravo id  outp u t as l ong  as  one
         / /c o m po nent fails
        d etail::e nable_ b uf fe r ing<Outp ut Ite rato r >  buff erin g (s ink);
        b ool r =  f alse;         b o ol f ailed= false;     / /  will be ignor e d
          {          detail: :dis a ble_ coun t in g<O u tputI terat or >  n o counting(sink);
            r = generate: :call(comp o n e nt, sink , ct x ,d elim, attr, fa iled) ;
          }
          if ( r) 
            bu ffe rin g.b u f fe r_copy();
       return  r; 
       } 

     / / avoid d ouble bu ff er in g      t emplate<t ype na meCompo n ent>
      bo ol  o p era tor()(b u ff e r _dir ec ti ve<C omp on ent>cons t & c omponen t)
       {          typ edef typename               trait s : :attribu te_of<Component, Contex t >::type 
         expected _ty pe;
        typede f alt er nat i v e_gen e r at e<            b uffer _d irec tive<Co mponent>, Attribut e , e xpected_type> 
       g e ne r ate ;         bool fai led = fals e;   // will b e  ig no red
          ret u rn gene rate::cal l(compone nt , si n k , c tx, delim,  attr, f ailed);
    }
      Outpu tI ter ator&  sink;       Contex t&  ctx;      Delimit er const& delim;
       Attr ibute  co nst& attr ;
  private:       // sil enc e M SVC w arn i ng C4 512: as sig n mentoper a tor could no t b e ge nerated
    a ltern ati v e_gene rate _function& operat o r= (alternativ e_ge n e rat e_f u ncti on  const&);
   };
 // spec ia lization fo r strict  a l terna tives    te mplate< t yp e name O utpu tIt erator, t ype na m e Conte xt ,t ypenam e De li miter, 
      ty p e name Attribute>    s t r uct a l ter nativ e_ generat e _fun ction<
       Output Iterat or,Conte xt, Del im iter,Att ri bute, mpl: : true_>
   {
 Attribute,_typename Strict>
_   struct_alternative_generate_function
 __ {
__  _  _alternative_generate_function(OutputIterator& sink_, Context& ctx_
_  __        , Delimiter const& d, Attribute const&_attr_)
_ ___    _: sink(sink_), ctx(ctx_), delim(d), attr(attr_)_{}

 _      template <typename_Component>
_  _    bool operator()(Component const& component)
 _     _{
  ___   _   typedef
  _     _      _typename traits::attribute_of<Component, Context>::type
   _    _ _ expected_type;
   _  _ _  _typedef
     _  _     __alternative_generate<Component, Attribute, expected_type>
___ _  __ __generate;

     __     // wrap_the given output iterator_avoid_output as long as_one
    _     _ //_component fails
_          _detail::enable_buffering<OutputIterator> buffering(sink);
    _   _ __bool r =_false;
_ _      _ _bool failed = false;  _ // will be_ignored
_     _     {
_    ___    _   detail::disable_counting<OutputIterator> nocounting(sink);
 _  _      __   r = generate::call(component,_sink,_ctx, delim, attr, failed);
  ___    _  }
   _        if_(r) 
 _    ___       buffering.buffer_copy();
  _ _  _    return r;
    _   }

   _    // avoid double buffering
   _    template <typename Component>
 _      bool_operator()(buffer_directive<Component> const& component)
 __     {
 ____  _  _ typedef typename_
 _  _ _  __     traits::attribute_of<Component, Context>::type
           _expected_type;
     _    __typedef alternative_generate<
 _   _       _  buffer_directive<Component>, Attribute, expected_type>
    __ _   _generate;

 _ _  _ _ _ bool_failed = false;    //_will_be ignored
       ____ return generate::call(component,_sink, ctx, delim,_attr, failed);
 _  __  }

   _  _ OutputIterator& sink;
 _      Context& ctx;
  _     Delimiter const& delim;
        Attribute const&_attr;

 _  private:
 _ __   // silence MSVC_warning C4512:_assignment operator could not be generated
  __    alternative_generate_function& operator= (alternative_generate_function const&);
    };

___ // specialization_for_strict alternatives
    template_<typename_OutputIterator,_typename_Context,_typename Delimiter,
    _   typename Attribute>
  __struct alternative_generate_function<
   _ __ OutputIterator, Context, Delimiter,_Attribute, mpl::true_>
  _ {