• <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 笑笑生 閱讀(672) 評論(1)  編輯 收藏 引用 所屬分類: STL/BOOST
            評論:
             
            Copyright © 笑笑生 Powered by: 博客園 模板提供:滬江博客
            欧美综合天天夜夜久久| 久久亚洲欧美日本精品| 2020久久精品亚洲热综合一本| 久久久久免费视频| 亚洲色欲久久久久综合网| 波多野结衣AV无码久久一区| AV狠狠色丁香婷婷综合久久| 欧美精品丝袜久久久中文字幕 | 狠狠色丁香久久综合婷婷| 热99re久久国超精品首页| 中文字幕久久亚洲一区| 99久久人妻无码精品系列 | 色成年激情久久综合| 亚洲日韩欧美一区久久久久我| 国产精品禁18久久久夂久| 久久久久久极精品久久久| 久久久久亚洲AV无码麻豆| 欧美精品一区二区久久| 2020最新久久久视精品爱| 无码人妻久久一区二区三区| 99热成人精品热久久669| 亚洲精品乱码久久久久久蜜桃| 久久99免费视频| 欧美丰满熟妇BBB久久久| 国产精品久久婷婷六月丁香| 国产精品丝袜久久久久久不卡| 日日噜噜夜夜狠狠久久丁香五月| 综合久久给合久久狠狠狠97色 | 精品久久久久久无码中文野结衣| 欧洲精品久久久av无码电影| 久久精品国产精品亚洲精品| 亚洲精品第一综合99久久| 久久综合狠狠综合久久97色| 久久久久99精品成人片| 国产精品丝袜久久久久久不卡| AA级片免费看视频久久| 国产精品美女久久久久av爽| 久久青草国产精品一区| 9191精品国产免费久久| 久久久久亚洲精品无码网址 | 久久综合噜噜激激的五月天|