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

            国产精品一久久香蕉国产线看 | 久久午夜夜伦鲁鲁片免费无码影视 | 久久99国产亚洲高清观看首页 | 国产精品亚洲综合久久| 三级片免费观看久久| 亚洲国产精品18久久久久久| 久久国产香蕉一区精品| 国产精品一区二区久久精品| 久久国产精品二国产精品| 久久精品国产亚洲av日韩| 亚洲人成无码网站久久99热国产| 国产福利电影一区二区三区久久老子无码午夜伦不 | 久久精品国产99国产精品| 久久中文字幕一区二区| 久久夜色精品国产网站| 亚洲精品无码成人片久久| www.久久精品| 中文字幕人妻色偷偷久久| 国产精品亚洲综合久久| 久久综合丝袜日本网| 一本久久a久久精品vr综合| A级毛片无码久久精品免费| 亚洲中文字幕久久精品无码APP| 狠狠综合久久综合中文88| 久久99国产乱子伦精品免费| 国产精品美女久久久久| 久久久无码精品亚洲日韩京东传媒| 亚洲欧洲久久久精品| 国产99久久久久久免费看| 国内精品久久久久久99蜜桃| 777午夜精品久久av蜜臀 | 蜜臀av性久久久久蜜臀aⅴ麻豆 | 国产精品无码久久四虎| 久久国产精品-久久精品| 久久99精品久久久久久动态图| 久久香综合精品久久伊人| 亚洲伊人久久综合中文成人网| 亚洲AV伊人久久青青草原| 国产精品成人久久久久久久| 91精品国产91久久久久久蜜臀| 久久播电影网|