• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            void main() { }

            Hello ,world !

            常用鏈接

            統計

            最新評論

            test Loki::Typelist

                  昨晚,測試  Loki C++ 庫 Typelist.h 的一些功能 -- 在BCB 6.0 環境下 。隨便曬曬了:

            //---------------------------------------------------------------------------
            #include <vcl.h>
            #include 
            <iostream>
            #include 
            <string> 
            #include 
            <typeinfo>
            #include 
            <windows.h>

            using namespace std;
            #include 
            "loki\Typelist.h"

            int main(int argc,char* argv[])
            {
                
            using namespace Loki ;   

            // ---- test TYPELIST_N -----------------
                cout << " ---- test TYPELIST_N -----" << "\n" ;
                typedef TYPELIST_4(signed 
            charshort intintlong int)
                        SignedIntegrals ;
                cout 
            << " typedef TYPELIST_4(signed char, short int, int, long int)"
                     
            << " SignedIntegrals ;" << "\n" ;

            // ---- test Length<>  -----------------
                cout << " ---- test Length<>  -----" << "\n" ;
                cout 
            << TL::Length<SignedIntegrals>::value << "\n" ;
                cout 
            << typeid(TL::TypeAt<SignedIntegrals ,1>::Result).name() << "\n" ; 
            // ---- test IndexOf -----------------
                cout << TL::IndexOf<SignedIntegrals ,int>::value << "\n" ;
            // ---- test Append<>  -----------------
                cout << " ---- test Append<>  ----" << "\n" ;
                typedef TL::Append
            <SignedIntegrals ,string>::Result Result ;
                cout 
            << TL::Length<Result>::value << "\n" ; //
                cout << typeid(TL::TypeAt<Result ,4>::Result).name() << "\n" ;
                
            // or : typedef TYPELIST_2(string ,String) SString ; //sString
                typedef TL::Append<Result ,TYPELIST_2(string ,String) >::Result Result ;
                cout 
            << TL::Length<Result>::value << "\n" ;
                
            //for(int i=0 ;i<TL::Length<Result>::value ;i++)     //
                    
            //cout << typeid(TL::TypeAt<Result ,ConstI>::Result).name() << "\n" ;
                
            //[C++ Error] E2396 Template argument must be a constant expression

            // ---- test TypeAt<>  -----------------
                cout << " ---- test TypeAt<>  ----" << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,6>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,5>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,4>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,3>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,2>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,1>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,0>::Result).name() << "\n" ;
            // ---- test Erase<>  -----------------
                cout << " ---- test Erase<>  ----" << "\n" ;
                cout 
            << TL::Length<TL::Erase<Result ,double>::Result>::value << "\n" ;// no double erase none
                cout << TL::Length<Result>::value << "\n" ;
                typedef TL::Erase
            <Result ,string>::Result Result ; // erase string OK
                cout << TL::Length<Result>::value << "\n" ;
                typedef TL::Erase
            <Result ,string>::Result Result ; // erase string OK
                cout << TL::Length<Result>::value << "\n" ;
                typedef TL::Erase
            <Result ,string>::Result Result ;// no string erase none
                cout << TL::Length<Result>::value << "\n" ;
            // ---- test Replace<>  -----------------
                cout << " ---- test Replace<>  ----" << "\n" ;
                cout 
            << TL::IndexOf<Result ,String>::value << "\n" ;// String exist -- 4     
                cout << TL::IndexOf<Result ,string>::value << "\n" ; // String doesn't exist -- -1
                typedef TL::Replace<Result ,String ,string>::Result Result ; // Replace String to string OK
                cout << TL::IndexOf<Result ,String>::value << "\n" ; // String doesn't exist -- -1
                cout << TL::IndexOf<Result ,string>::value << "\n" ; // string exist -- 4
            // ---- test ReplaceAll<>  -----------------
                cout << " ---- test ReplaceAll<>  ----" << "\n" ;
                typedef TL::Append
            <Result ,TYPELIST_2(string ,string>::Result Result ;
                cout 
            << typeid(TL::TypeAt<Result ,4>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,5>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,6>::Result).name() << "\n" ; 
                typedef TL::ReplaceAll
            <Result ,string ,String >::Result Result ;   
                cout 
            << typeid(TL::TypeAt<Result ,4>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,5>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,6>::Result).name() << "\n" ;
            // ---- test Reverse<>  -----------------
                cout << " ---- test Reverse<>  ----" << "\n" ;
                
            using namespace Loki::TL ;
                cout 
            << Length<Result>::value << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,0>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,1>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,2>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,3>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,4>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,5>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,6>::Result).name() << "\n" ;
                typedef Reverse
            <Result>::Result Result ;
                cout 
            << typeid(TL::TypeAt<Result ,0>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,1>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,2>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,3>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,4>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,5>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,6>::Result).name() << "\n" ;
            // ---- test NoDuplicates<>  --------------------   
                cout << " " << "\n" ;

            // ---- test MostDerived<>  ---------------------  
                cout << " " << "\n" ;

            // ---- test DerivedToFront<>  ------------------  
                cout << " " << "\n" ;

            // ---- test EraseALL<> -----------------
                cout << " ---- test EraseALL<> -----" << "\n" ;
                cout 
            << Length<Result>::value << endl ;
                typedef EraseAll
            <Result ,String>::Result Result ;
                cout 
            << Length<Result>::value << endl ;
                cout 
            << typeid(TL::TypeAt<Result ,0>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,1>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,2>::Result).name() << "\n" ;
                cout 
            << typeid(TL::TypeAt<Result ,3>::Result).name() << "\n" ;  
                typedef Replace
            <Result ,SignedIntegrals ,NullType>::Result Result ;// no replace 
                cout << Length<Result>::value << endl ;    
                typedef EraseAll
            <Result ,SignedIntegrals>::Result Result ; // no erase
                cout << Length<Result>::value << endl ;

            /*  ***********************************************************/
                cout 
            << "\n\n\n\n       Hello ,World !" <<endl ;
                system(
            "pause");
                
            return 0;
            }



            //---------------------------------------------------------------------------

            繼續好好學習Modern C++ Design -- C++ 設計新思維 。

            posted on 2009-07-09 13:34 only 閱讀(466) 評論(0)  編輯 收藏 引用 所屬分類: 瑣碎編程

            亚洲AV无码久久精品蜜桃| 免费精品久久久久久中文字幕| 日韩欧美亚洲综合久久| 久久人人爽人人人人片av| 亚洲精品无码久久久久去q| 国产精品久久免费| 国产精品久久久久久久app| 久久97精品久久久久久久不卡| 国产伊人久久| 久久一日本道色综合久久| 国内精品伊人久久久久网站| 亚洲精品无码久久久久去q | 久久人人爽人人爽人人片AV不 | 国产成人精品久久免费动漫| 欧美久久一区二区三区| 精品国产一区二区三区久久| 久久精品国产欧美日韩99热| 亚洲乱亚洲乱淫久久| 久久精品亚洲一区二区三区浴池 | 精品久久久久久亚洲精品| 天天影视色香欲综合久久| AAA级久久久精品无码区| 97久久精品无码一区二区| 精品熟女少妇AV免费久久| 人妻精品久久久久中文字幕| 国产成人精品久久亚洲高清不卡| 久久99精品久久久久久久久久| 亚洲欧美日韩精品久久亚洲区| 国产国产成人久久精品| 久久91综合国产91久久精品| 91精品国产高清久久久久久io| 日本欧美久久久久免费播放网| 久久久久波多野结衣高潮| 欧美久久久久久| 亚洲国产精品无码久久SM| 亚洲精品乱码久久久久久久久久久久 | 久久97久久97精品免视看秋霞| 欧美午夜A∨大片久久| 九九热久久免费视频| 久久精品国产72国产精福利| 久久精品国产99久久久香蕉|