• <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  
              愛過知情重醉過知酒濃   花開花謝終是空   緣份不停留像春風來又走   女人如花花似夢
            公告
            日歷
            <2006年6月>
            28293031123
            45678910
            11121314151617
            18192021222324
            2526272829301
            2345678
            統計
            • 隨筆 - 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 笑笑生 閱讀(669) 評論(1)  編輯 收藏 引用 所屬分類: STL/BOOST
            評論:
             
            Copyright © 笑笑生 Powered by: 博客園 模板提供:滬江博客
            人妻无码精品久久亚瑟影视| 久久精品亚洲日本波多野结衣| 国产精品久久久久久久久免费| 99re这里只有精品热久久| 久久国产精品久久精品国产| 成人国内精品久久久久影院| 久久人人爽人人爽人人片AV东京热| 武侠古典久久婷婷狼人伊人| 久久人人爽人人爽人人片av高请| 日本精品久久久久中文字幕| 国产精品久久久久a影院| 久久w5ww成w人免费| 亚洲人成无码网站久久99热国产 | 久久大香香蕉国产| 久久国产精品波多野结衣AV| 久久精品黄AA片一区二区三区| 久久久久亚洲AV综合波多野结衣| 国产情侣久久久久aⅴ免费| 人妻丰满?V无码久久不卡| 亚洲国产二区三区久久| 一本一本久久A久久综合精品| 成人亚洲欧美久久久久| 97久久精品无码一区二区天美| 久久精品桃花综合| 色综合久久88色综合天天 | 狠狠精品干练久久久无码中文字幕| 久久久精品2019免费观看| 欧美精品国产综合久久| 欧美色综合久久久久久| 久久免费99精品国产自在现线| 亚洲国产成人久久精品动漫| 99国产欧美久久久精品蜜芽| 久久久一本精品99久久精品66| 精品国产青草久久久久福利| 久久精品国产一区二区电影| 99久久精品国产一区二区三区 | 久久久WWW免费人成精品| 91精品国产91久久久久久蜜臀| 97精品伊人久久大香线蕉app| 91精品国产9l久久久久| 狠狠狠色丁香婷婷综合久久俺|