• <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 笑笑生 閱讀(654) 評論(1)  編輯 收藏 引用 所屬分類: STL/BOOST
            評論:
             
            Copyright © 笑笑生 Powered by: 博客園 模板提供:滬江博客
            72种姿势欧美久久久久大黄蕉| 久久精品免费一区二区三区| 亚洲国产成人久久一区久久| 亚洲国产天堂久久久久久| 中文字幕日本人妻久久久免费 | 国产精品99久久久久久宅男小说| 亚洲国产香蕉人人爽成AV片久久 | 久久青青草原精品影院| 99久久精品免费看国产一区二区三区| 久久久久国产日韩精品网站| 国产精品成人久久久| 热久久这里只有精品| 久久精品国产亚洲AV香蕉| 国产午夜精品理论片久久 | 99国产精品久久久久久久成人热| 成人午夜精品久久久久久久小说| 国产精品久久久久久五月尺| 国产 亚洲 欧美 另类 久久 | 97久久久久人妻精品专区| 久久综合狠狠综合久久97色| 国内精品久久久久影院免费| 久久人人青草97香蕉| 国产高潮久久免费观看| 成人综合伊人五月婷久久| 无码任你躁久久久久久久| 国产69精品久久久久777| 精品综合久久久久久97| 久久精品中文字幕大胸| 久久综合九色欧美综合狠狠 | 亚洲欧美国产日韩综合久久| 91久久福利国产成人精品| 久久精品一区二区| 老司机国内精品久久久久| 久久国产精品99精品国产| 久久精品麻豆日日躁夜夜躁| 久久狠狠高潮亚洲精品| 久久99国产精品久久99果冻传媒| 国产精品久久久久jk制服| 成人国内精品久久久久一区| 国产精品一久久香蕉国产线看观看| 久久狠狠高潮亚洲精品|