• <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  
              愛過知情重醉過知酒濃   花開花謝終是空   緣份不停留像春風來又走   女人如花花似夢
            公告
            日歷
            <2025年6月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            293012345
            統計
            • 隨筆 - 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: 博客園 模板提供:滬江博客
            热久久国产欧美一区二区精品| 久久精品无码专区免费青青| 亚洲综合精品香蕉久久网97| 91精品国产91热久久久久福利| 国产69精品久久久久777| 久久久久久精品免费看SSS | 色婷婷综合久久久久中文一区二区| 香蕉99久久国产综合精品宅男自 | 99久久无码一区人妻| 久久强奷乱码老熟女网站| 一本色道久久综合亚洲精品| 91精品国产高清久久久久久io | 久久精品国产亚洲Aⅴ蜜臀色欲 | 国产一区二区精品久久| 欧美精品福利视频一区二区三区久久久精品 | 国色天香久久久久久久小说| 久久亚洲国产精品一区二区| 老男人久久青草av高清| 欧美久久综合性欧美| 婷婷久久香蕉五月综合加勒比| 久久久久久综合一区中文字幕 | 少妇久久久久久被弄到高潮 | 久久伊人精品一区二区三区| 色综合久久精品中文字幕首页 | 91麻豆精品国产91久久久久久 | 久久久久免费视频| 精品久久久久久国产91| 欧美牲交A欧牲交aⅴ久久| 精品久久久久久无码免费| 久久久精品人妻一区二区三区蜜桃 | 久久免费国产精品一区二区| 亚洲精品无码久久久影院相关影片| 久久国产午夜精品一区二区三区| 国产午夜免费高清久久影院| 一本久久a久久精品亚洲| 精品视频久久久久| 中文字幕久久欲求不满| 久久精品男人影院| 亚洲伊人久久精品影院| 麻豆亚洲AV永久无码精品久久| 一本一道久久a久久精品综合|