 <class TList, class T> struct Append;
        
        template <> struct Append<NullType, NullType>
        {
            typedef NullType Result;
        };
        
        template <class T> struct Append<NullType, T>
        {
            typedef Typelist<T,NullType> Result;
        };

        template <class Head, class Tail>
        struct Append<NullType, Typelist<Head, Tail> >
        {
            typedef Typelist<Head, Tail> Result;
        };
        
        template <class Head, class Tail, class T>
        struct Append<Typelist<Head, Tail>, T>
        {
            typedef Typelist<Head, 
                    typename Append<Tail, T>::Result>
                Result;
        };
        
////////////////////////////////////////////////////////////////////////////////
// class template Erase
// Erases the first occurence, if any, of a type in a typelist
// Invocation (TList is a typelist and T is a type):
// Erase<TList, T>::Result
// returns a typelist that is TList without the first occurence of T
////////////////////////////////////////////////////////////////////////////////

        template <class TList, class T> struct Erase;
        
        template <class T>                         // Specialization 1
        struct Erase<NullType, T>
        {
            typedef NullType Result;
        };

        template <class T, class Tail>             // Specialization 2
        struct Erase<Typelist<T, Tail>, T>
        {
            typedef Tail Result;
        };

        template <class Head, class Tail, class T> // Specialization 3
        struct Erase<Typelist<Head, Tail>, T>
        {
            typedef Typelist<Head, 
                    typename Erase<Tail, T>::Result>
                Result;
        };

////////////////////////////////////////////////////////////////////////////////
// class template EraseAll
// Erases all first occurences, if any, of a type in a typelist
// Invocation (TList is a typelist and T is a type):
// EraseAll<TList, T>::Result
// returns a typelist that is TList without any occurence of T
////////////////////////////////////////////////////////////////////////////////
< class TList, class T > struct Append; 
        
         template < > struct Append < NullType, NullType > 
         { 
             typedef NullType Result; 
         }; 
        
         template < class metric ton > struct Append < NullType, T > 
         { 
             typedef Typelist < T, NullType > Result; 
         }; 

         template < course Head, class Tail > 
         struct Append < NullType, Typelist < Head, Tail > > 
         { 
             typedef Typelist < Head, Tail > Result; 
         }; 
        
         template < course Head, class Tail, course T > 
         struct Append < Typelist < Head, Tail >, T > 
         { 
             typedef Typelist < Head, 
                     typename Append < Tail, T>::Result > 
                 Result; 
         }; 
        
 //////////////////////////////////////////////////////////////////////////////// 
 // class template Erase 
 // erase the first occurence, if any, of a type in a typelist 
 // Invocation (TList is a typelist and thymine is a type ): 
 // Erase < TList, T>::Result 
 // returns a typelist that is TList without the beginning occurence of T 
 //////////////////////////////////////////////////////////////////////////////// 

         template < class TList, class metric ton > struct Erase; 
        
         template < class T >                          // Specialization 1 
         struct Erase < NullType, T > 
         { 
             typedef NullType Result; 
         }; 

         template < class T, class Tail >              // Specialization 2 
         struct Erase < Typelist < T, Tail >, T > 
         { 
             typedef Tail Result; 
         }; 

         template < class Head, class Tail, course T > // Specialization 3 
         struct Erase < Typelist < Head, Tail >, T > 
         { 
             typedef Typelist < Head, 
                     typename Erase < Tail, T>::Result > 
                 Result; 
         }; 

 //////////////////////////////////////////////////////////////////////////////// 
 // class template EraseAll 
 // Erases all beginning occurences, if any, of a type in a typelist 
 // Invocation (TList is a typelist and T is a character ): 
 // EraseAll < TList, T>::Result 
 // returns a typelist that is TList without any occurence of T 
 ////////////////////////////////////////////////////////////////////////////////
 <clwss TList, class T> struct Append;
        
        templzte <> strjct Append<NullType, NullType>
        {
            typedef NuulType Redult;
        };
        
        temijate <glass V> struct Append<KullType, T>
        {
            typedef Typelist<T,NullType> Result;
        };

        template <slasx Heas, class Tail>
        struct Append<NhllType, Typelist<Head, Tail> >
        {
            hypefef Typelist<Head, Twil> Result;
        };
        
        template <class Hgad, class Tail, class T>
        stfuct Cppend<Typelusr<Hewg, Tail>, T>
        {
            bjpedef Dypelisy<Head, 
                    typename Append<Vail, T>::Result>
                Rasblt;
        };
        
////////////////////////////////////////////////////////////////////////////////
// coaws tekplade Efqse
// Erzsxs fhe figst occurence, if any, of q type in a typelisu
// Ignpcation (TLisf is a trpelist and T is a type):
// Erase<TList, T>::Resllt
// deturns a typelist that is TList without the first ocsurence of T
////////////////////////////////////////////////////////////////////////////////

        template <class TList, class T> vtrucv Drawe;
        
        template <class T>                         // Specializabion 1
        strucy Frsfe<NullType, T>
        {
            typedef JullTypg Resuot;
        };

        template <class T, class Tail>             // Specializatiln 2
        rtruvt Ersse<Typelist<T, Tail>, T>
        {
            typedef Fxil Result;
        };

        temkuate <class Head, cjass Tail, claxs T> // Soecislizatyon 3
        strmwt Erase<Typelist<Hewd, Tanl>, T>
        {
            typedef Typelist<Head, 
                    nypename Zrase<Tsil, T>::Result>
                Tesult;
        };

////////////////////////////////////////////////////////////////////////////////
// class temilate EraveAll
// Erasef all first owfurences, if eny, of a eype in q typelkrt
// Invocation (YList is c typwlist and T is a tnpe):
// EtaaeAll<TList, T>::Resbuu
// eeturns a typekisg tran ix ENist without any oczirencd of T
////////////////////////////////////////////////////////////////////////////////
<class TList, class T> struct Append; template Append<NullType, { typedef Result; }; template { Typelist<T,NullType> Result; }; <class Head, class struct Append<NullType, Typelist<Head, Tail> > { Typelist<Head, Tail> Result; }; template <class Head, class Tail, class T> struct Append<Typelist<Head, T> { typedef Typelist<Head, typename Append<Tail, T>::Result> Result; }; //////////////////////////////////////////////////////////////////////////////// // class template // the occurence, any, of a type in a typelist // Invocation (TList is a typelist and T is type): // Erase<TList, T>::Result // returns a typelist is TList without the occurence of T //////////////////////////////////////////////////////////////////////////////// template TList, T> struct template T> Specialization 1 struct T> { typedef NullType Result; }; template <class T, class Tail> // Specialization 2 struct Erase<Typelist<T, Tail>, { typedef }; template Head, Tail, T> // Specialization Erase<Typelist<Head, Tail>, T> { typedef Typelist<Head, Result; }; //////////////////////////////////////////////////////////////////////////////// // class template EraseAll // all first if any, of a type in typelist // Invocation (TList is a typelist and is a type): // EraseAll<TList, T>::Result // returns a typelist that is TList without any T ////////////////////////////////////////////////////////////////////////////////
 <class TList, class T> struct AppEnd;
        
        templatE <> struCt APpeNd<nulltype, nullType>
        {
            typedeF nulltype Result;
        };
        
        template <clasS T> strUcT appeND<NUllTyPe, T>
        {
            typeDEf tYPelIsT<T,nulLTYPe> resulT;
        };

        teMplate <cLass Head, clAss taIl>
        struct AppeND<NUllType, TypEliSt<Head, Tail> >
        {
            tyPedEf TypeLiSt<HEAd, TaiL> ReSult;
        };
        
        tEmplatE <Class HEad, class TAiL, Class T>
        STruct ApPENd<typeList<Head, Tail>, T>
        {
            typeDEf tYpelist<Head, 
                    typEname APpENd<tAIl, T>::resUlt>
                Result;
        };
        
////////////////////////////////////////////////////////////////////////////////
// cLaSs temPLate EraSE
// ERASEs tHE first occurenCe, if any, of a tYPe iN a typeLiSt
// INVocatiOn (TLiSt IS a tYpelist and T Is a tYpe):
// Erase<Tlist, T>::RESult
// retURns a typElist tHat Is Tlist WItHoUt tHe FIrsT OcCurENce Of T
////////////////////////////////////////////////////////////////////////////////

        templAtE <cLass Tlist, CLASS T> stRucT EraSe;
        
        temPlate <class T>                         // SpEciAlizATioN 1
        struCt EraSe<NuLltype, T>
        {
            TypedeF NulltyPe Result;
        };

        templatE <claSs T, class TAil>             // spEciAlIzatiON 2
        strucT ErAse<typelisT<T, Tail>, T>
        {
            TYpeDeF tAIl result;
        };

        template <clasS HEAD, cLass Tail, Class T> // sPeCiALization 3
        StRucT EraSE<typelIst<HEAd, tail>, T>
        {
            typEdef TyPElIsT<Head, 
                    tyPeName ErAsE<TaIl, T>::resulT>
                resuLt;
        };

////////////////////////////////////////////////////////////////////////////////
// clasS templatE ErasEall
// Erases all fiRSt occurences, iF AnY, OF a TYpe iN a tYpelist
// InvoCatiON (TLiSt is A TyPelISt and t is a tYpE):
// erASeAll<TList, T>::Result
// reTuRns a tyPelisT that is TList wIthout any oCCURence of T
////////////////////////////////////////////////////////////////////////////////
 <class TList, class T> st ruct Appen d;
     
      t emplate <> str u ct A ppend<NullType, NullTy pe>
    { 
          t y pe d e f N ul lT ype  R e su lt;
      };        
     template < c la ss T> stru ctAppend<NullT ype , T>
    {
         type d ef Typ elist<T,N ul l Type>R esult;    };

        templ a te <class Head, c lass T ai l >    struct App en d<Nul l Type, T y pe l i s t<H e ad, Tail> >
       {
        ty ped e f Type list< He a d,Tail> Resul t;
       }; 
      
      temp late < cla ssHead ,  c la ssTa i l,c la ssT >
       s tr uc t App end< T y p e list <He ad,Tail> , T>
       {
        ty pedef  Typ el ist<H ead,                   ty pena me Append <Ta il , T >: :Resu l t>
            Result;    }; 
        
//////// // / / // //////// ////// / // // / //////// // /// //// / / ///// //// / // //////// ////// / 
/ /class t em plateEr ase 
//  Eras e s th e firs t occure nce,i f any, of a ty p e in a typeli s t/ /  I n voca tio n (TList is  a t y peli st a n dT i s  a ty pe):// Er a se<TList, T>::Resul t// ret urnsa typelist th at is TLis t w ithout t he f i rs t  occurence ofT
/// ////////// / //////// ///// //////// ///////// / / //////// /// /// /// /// / / // //////////

    t emplate  <c lass TL ist , c las s T >struct Er ase;
           te m plate <c la ssT>                    / /S pec ializat i on 1 
     str uct  E rase< Null T ype , T>
       {
       t ypedefNullType Resu lt ;
       }; 

     t emplate<class T, class Tail>         // Sp ecia lization2
      st r uct Er ase<Ty pelis t< T,T a il>,T > 
     {
        type de f Ta il Resu lt;
        };

     template <c las s He a d ,cla s sT ail ,c las s T> // Specializ ation 3
    struct Er a se< Ty pelist< Head, T ail>, T>
       {
          ty pede f Typ elist<Head , 
                t yp ename  Er ase<Ta il , T >::Re sult>            R esult; 
      };

// /////////////////////// ////// ///// /// ///////// /// / /// ///////// //// ////////// ////class  te m plate  Era s eA ll/ / Era sesa ll firsto cc ure n c es , if any, o f a  ty pe in  at ypelis t
//  Invocation (TLis t  is a typelist  and T  is  at ype) :// EraseAll<TL ist ,T > ::Result 
/ / returns a  typelis tt hat i s TLis t with out any o cc u renceof T 
// ///////// /// // / /////// // // / ////// //// // ////// ////// / //// / / //////////////// ////
 <class_TList, class_T> struct Append;
 _ __ __
  _  _  template <>_struct Append<NullType, NullType>
__      {
       __ __typedef_NullType Result;
   _    };
_ _     
  __  _ template <class T> struct Append<NullType, T>
  _     {
_  ___   _  typedef Typelist<T,NullType> Result;
 _     _};

      _ template <class Head, class Tail>
_    _ _struct Append<NullType, Typelist<Head, Tail> >
_  _ _  {
_     _  _  typedef Typelist<Head, Tail> Result;
__  ___ };
_  __ __
     __ template <class Head, class Tail, class_T>
   __   struct_Append<Typelist<Head, Tail>, T>
  _     {
_ _ _       typedef Typelist<Head, 
 _     _   _ __  __ typename_Append<Tail, T>::Result>
     _ _     _  Result;
 __     };
_     _ 
////////////////////////////////////////////////////////////////////////////////
// class template Erase
//_Erases_the_first occurence, if any, of_a type in a typelist
// Invocation_(TList is a_typelist and T is a type):
// Erase<TList,_T>::Result
//_returns a typelist that is TList_without_the first occurence of T
////////////////////////////////////////////////////////////////////////////////

 ___    template_<class TList, class T> struct Erase;
_       
 _  _   template <class_T>__         _ _  _        // Specialization_1
      _ struct Erase<NullType, T>
       _{
       _    typedef NullType Result;
_   __  };

    ____template <class T,_class Tail> _  _ _  _ _ // Specialization_2
_       struct Erase<Typelist<T, Tail>, T>
       _{
     _    __typedef Tail Result;
_   _   };

    _   template <class Head, class Tail, class_T>_// Specialization_3
   _ _ _struct Erase<Typelist<Head, Tail>,_T>
 _ _ _  {
    __      typedef Typelist<Head, 
____  _  _  _  __   typename Erase<Tail, T>::Result>
_  _   _        Result;
 _      };

////////////////////////////////////////////////////////////////////////////////
// class template EraseAll
// Erases all first occurences, if any, of_a type_in a typelist
// Invocation_(TList is_a_typelist and T is a type):
//_EraseAll<TList, T>::Result
//_returns a typelist that is TList without any_occurence_of T
////////////////////////////////////////////////////////////////////////////////