• <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)  編輯 收藏 引用 所屬分類: 瑣碎編程

            色88久久久久高潮综合影院| 久久久久中文字幕| 久久精品人人做人人爽电影| 无码国内精品久久人妻蜜桃| 香港aa三级久久三级| 欧美精品九九99久久在观看| 久久久久久伊人高潮影院 | 国产精品久久久久久久午夜片 | 久久青青色综合| 人妻久久久一区二区三区| 亚洲精品国产成人99久久| 无码国内精品久久综合88| 久久精品国内一区二区三区| 久久综合五月丁香久久激情| 青草国产精品久久久久久| 精品国产福利久久久| 久久亚洲色一区二区三区| 亚洲人成无码久久电影网站| 亚洲天堂久久精品| 欧美日韩精品久久久久| 狠狠色噜噜色狠狠狠综合久久| 久久婷婷国产综合精品| 久久美女网站免费| 午夜精品久久久内射近拍高清 | 久久国产精品免费一区二区三区| 国产一区二区精品久久凹凸| 久久中文精品无码中文字幕| 伊人久久大香线焦AV综合影院| 91久久成人免费| 国产精品亚洲综合久久| 精品久久久久久无码中文字幕一区 | 午夜精品久久久久久中宇| 久久精品国产色蜜蜜麻豆| 久久精品国产色蜜蜜麻豆| 久久精品国产免费一区| 久久99精品九九九久久婷婷| 欧美黑人激情性久久| 久久精品国产WWW456C0M| 国产偷久久久精品专区| 色综合久久中文字幕综合网| 99麻豆久久久国产精品免费|