• <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 閱讀(465) 評論(0)  編輯 收藏 引用 所屬分類: 瑣碎編程

            91秦先生久久久久久久| 99久久国语露脸精品国产| 久久综合九色综合欧美就去吻| 久久影视综合亚洲| 无码人妻精品一区二区三区久久久 | 久久精品国产精品亚洲毛片| 久久国产乱子伦免费精品| 国产精品美女久久久久| 婷婷久久综合| 国产成人精品久久综合| 久久综合九色综合网站| 久久福利片| 国产美女久久久| 久久久久无码精品国产| 欧美精品丝袜久久久中文字幕 | 亚洲精品无码久久毛片| 97热久久免费频精品99| 久久国产免费直播| 亚洲精品无码久久久| 久久精品国产亚洲精品| 久久精品免费一区二区三区| 日产精品久久久久久久性色| 亚洲人AV永久一区二区三区久久| 91精品日韩人妻无码久久不卡| AV色综合久久天堂AV色综合在| 国产精品亚洲综合久久| 久久五月精品中文字幕| 久久精品国产只有精品66| 91麻精品国产91久久久久| 国产叼嘿久久精品久久| 国产精品一区二区久久精品无码| 成人久久精品一区二区三区| 久久久久亚洲av无码专区喷水| 亚洲国产精品成人久久| 日韩精品久久无码人妻中文字幕| 少妇内射兰兰久久| 97久久综合精品久久久综合| 7777久久亚洲中文字幕| 久久精品aⅴ无码中文字字幕不卡| 精品久久久久久亚洲精品| 久久这里只精品国产99热|