• <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年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567
            統計
            • 隨筆 - 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 笑笑生 閱讀(652) 評論(1)  編輯 收藏 引用 所屬分類: STL/BOOST
            評論:
             
            Copyright © 笑笑生 Powered by: 博客園 模板提供:滬江博客
            久久天天躁狠狠躁夜夜2020| 国产亚洲综合久久系列| 亚洲国产精品无码久久青草| 亚洲国产日韩欧美综合久久| 97久久国产露脸精品国产| 国产精品一区二区久久国产| 性做久久久久久久| 精品人妻伦一二三区久久| 99精品国产99久久久久久97 | 奇米影视7777久久精品人人爽| 77777亚洲午夜久久多人| 国产精品久久久久无码av| 色欲综合久久躁天天躁| 97久久精品无码一区二区| 综合久久给合久久狠狠狠97色 | 99久久国产综合精品麻豆| 久久噜噜久久久精品66| 精品蜜臀久久久久99网站| 性做久久久久久免费观看| 亚洲综合精品香蕉久久网97| 亚洲香蕉网久久综合影视| 久久久99精品成人片中文字幕| 精品久久久久久无码专区| 中文成人无码精品久久久不卡 | 69SEX久久精品国产麻豆| 亚洲欧洲精品成人久久奇米网| 国产精品99久久久久久猫咪 | 久久免费看黄a级毛片| 久久久久亚洲av毛片大| 成人a毛片久久免费播放| 久久99精品久久久久久久久久| 久久久久久精品久久久久| 性高朝久久久久久久久久| 国内精品久久久久久久涩爱| 99久久国产综合精品麻豆| 久久大香香蕉国产| 精品国产VA久久久久久久冰| 久久婷婷五月综合97色一本一本| 精品人妻伦九区久久AAA片69| 久久午夜夜伦鲁鲁片免费无码影视| 久久精品国产国产精品四凭|