• <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>
            Impossible is nothing  
              愛過知情重醉過知酒濃   花開花謝終是空   緣份不停留像春風來又走   女人如花花似夢
            公告
            日歷
            <2007年12月>
            2526272829301
            2345678
            9101112131415
            16171819202122
            23242526272829
            303112345
            統計
            • 隨筆 - 8
            • 文章 - 91
            • 評論 - 16
            • 引用 - 0

            導航

            常用鏈接

            留言簿(4)

            隨筆分類(4)

            隨筆檔案(8)

            文章分類(77)

            文章檔案(91)

            相冊

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

             

            1.使用max/min時可以給一個比較函數指針。
            #include <algorithm>
            using namespace std;

            /* function that compares two pointers by comparing the values to which they point
            ?*/
            bool int_ptr_less (int* a, int* b)
            {
            ??? return *a < *b;
            }

            int main()
            {
            ??? int x = 17;
            ??? int y = 42;
            ??? int* px = &x;
            ??? int* py = &y;
            ??? int* pmax;

            ??? // call max() with special comparison function
            ??? pmax = max (px, py, int_ptr_less);
            ??? //...
            }
            這是源代碼(MSVC7):
            template<class _Ty,
            ?class _Pr> inline
            ?const _Ty& _MAX(const _Ty& _Left, const _Ty& _Right, _Pr _Pred)
            ?{?// return larger of _Left and _Right using _Pred
            ?return (_Pred(_Left, _Right) ? _Right : _Left);
            ?}

            2.設置boolalpha可以讓流輸出bool值的字符串形式

            ?cout << boolalpha ;
            ?bool b = true;
            ?cout << b <<"*********"<<!b << endl;
            結果:
            true*********false
            3。一下代碼可以測試你的系統各類型的范圍
            #include <iostream>
            #include <limits>
            #include <string>
            using namespace std;

            int main()
            {
            ?? // use textual representation for bool
            ?? cout << boolalpha;

            ?? // print maximum of integral types
            ?? cout << "max(short): " << numeric_limits<short>::max() << endl;
            ?? cout << "max(int):?? " << numeric_limits<int>::max() << endl;
            ?? cout << "max(long):? " << numeric_limits<long>::max() << endl;
            ?? cout << endl;

            ?? // print maximum of floating-point types
            ?? cout << "max(float):?????? "
            ??????? << numeric_limits<float>::max() << endl;
            ?? cout << "max(double):????? "
            ??????? << numeric_limits<double>::max() << endl;
            ?? cout << "max(long double): "
            ??????? << numeric_limits<long double>::max() << endl;
            ?? cout << endl;

            ?? // print whether char is signed
            ?? cout << "is_signed(char): "
            ??????? << numeric_limits<char>::is_signed << endl;
            ?? cout << endl;

            ?? // print whether numeric limits for type string exist
            ?? cout << "is_specialized(string): "
            ??????? << numeric_limits<string>::is_specialized << endl;
            }

            posted on 2006-06-28 16:12 笑笑生 閱讀(665) 評論(1)  編輯 收藏 引用 所屬分類: STL/BOOST
            評論:
             
            Copyright © 笑笑生 Powered by: 博客園 模板提供:滬江博客
            久久婷婷五月综合色高清| 久久中文字幕人妻熟av女| 久久国产精品一国产精品金尊| 久久国产精品成人影院| 国产精品日韩欧美久久综合| 亚洲欧洲久久久精品| 国内精品伊人久久久久| 欧美久久一级内射wwwwww.| 97精品伊人久久大香线蕉app| 久久久网中文字幕| 久久国产精品无码HDAV| 国产色综合久久无码有码| 精品久久久久久久久中文字幕| 色天使久久综合网天天| 色综合久久精品中文字幕首页| 久久精品国产AV一区二区三区| 国内精品久久久久久中文字幕| 亚洲精品乱码久久久久久蜜桃图片| 91麻豆精品国产91久久久久久| 国内精品综合久久久40p| 久久久久久国产精品美女| 久久91精品国产91久久户| 亚洲午夜久久久影院伊人| 久久亚洲精品国产精品婷婷| 国产精自产拍久久久久久蜜| 77777亚洲午夜久久多喷| 久久人爽人人爽人人片AV| 久久婷婷五月综合成人D啪| 一级女性全黄久久生活片免费 | 色播久久人人爽人人爽人人片AV| 久久精品国产亚洲77777| 亚洲人成伊人成综合网久久久| 看全色黄大色大片免费久久久| 青青国产成人久久91网| 精品一区二区久久久久久久网站| 新狼窝色AV性久久久久久| 久久99九九国产免费看小说| 亚洲欧美成人久久综合中文网| 欧美久久综合九色综合| 久久这里都是精品| 久久永久免费人妻精品下载|