• <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精品国产综合久久婷婷| 天天综合久久一二三区| 亚洲国产精品狼友中文久久久 | 久久久久久毛片免费播放| 国产精品久久久香蕉| 久久久亚洲裙底偷窥综合| 无码人妻久久一区二区三区蜜桃| 日韩AV毛片精品久久久| 久久久久国产一区二区| 精品久久久无码21p发布| 免费精品久久天干天干| 亚洲国产欧洲综合997久久| 久久人妻少妇嫩草AV无码专区| 亚洲精品乱码久久久久久蜜桃图片| 亚洲中文字幕久久精品无码APP| 人妻精品久久久久中文字幕一冢本| 久久国产精品无码一区二区三区| 97久久超碰国产精品旧版| 久久精品国产亚洲沈樵| 天天做夜夜做久久做狠狠| 亚洲va久久久噜噜噜久久天堂 | 亚洲国产精品无码久久SM| 久久91精品国产91久久小草| 狠狠色综合网站久久久久久久 | 国产成人久久精品一区二区三区| www.久久99| 亚洲精品第一综合99久久| 久久久噜噜噜www成人网| 久久精品国产久精国产一老狼| 无码人妻久久一区二区三区| 久久精品国产亚洲综合色| 精品久久久久久国产三级| 亚洲欧美日韩久久精品第一区| 狠狠色噜噜狠狠狠狠狠色综合久久| 精品国产一区二区三区久久蜜臀 | 亚洲伊人久久成综合人影院| 久久精品毛片免费观看| 久久婷婷色综合一区二区| 色偷偷888欧美精品久久久| 久久亚洲国产成人精品性色|