• <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  
              愛(ài)過(guò)知情重醉過(guò)知酒濃   花開(kāi)花謝終是空   緣份不停留像春風(fēng)來(lái)又走   女人如花花似夢(mèng)
            公告
            日歷
            <2006年5月>
            30123456
            78910111213
            14151617181920
            21222324252627
            28293031123
            45678910
            統(tǒng)計(jì)
            • 隨筆 - 8
            • 文章 - 91
            • 評(píng)論 - 16
            • 引用 - 0

            導(dǎo)航

            常用鏈接

            留言簿(4)

            隨筆分類(4)

            隨筆檔案(8)

            文章分類(77)

            文章檔案(91)

            相冊(cè)

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

             

            1.使用max/min時(shí)可以給一個(gè)比較函數(shù)指針。
            #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.設(shè)置boolalpha可以讓流輸出bool值的字符串形式

            ?cout << boolalpha ;
            ?bool b = true;
            ?cout << b <<"*********"<<!b << endl;
            結(jié)果:
            true*********false
            3。一下代碼可以測(cè)試你的系統(tǒng)各類型的范圍
            #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) 評(píng)論(1)  編輯 收藏 引用 所屬分類: STL/BOOST
            評(píng)論:
             
            Copyright © 笑笑生 Powered by: 博客園 模板提供:滬江博客
            精品久久8x国产免费观看| 精品久久久久久久久中文字幕| 久久国产视屏| 漂亮人妻被中出中文字幕久久| 久久久无码精品亚洲日韩京东传媒 | 久久棈精品久久久久久噜噜| 精品久久久无码人妻中文字幕豆芽| 97久久国产亚洲精品超碰热 | 中文精品99久久国产 | 久久av免费天堂小草播放| 一级女性全黄久久生活片免费 | 久久无码AV一区二区三区| 99999久久久久久亚洲| 亚洲国产精品综合久久一线| 久久久久久久久无码精品亚洲日韩 | 少妇精品久久久一区二区三区| 91精品婷婷国产综合久久| 亚洲AV无码久久寂寞少妇| 日本加勒比久久精品| 久久亚洲私人国产精品| 亚洲国产成人精品91久久久 | 精品久久8x国产免费观看| 久久精品国产男包| 亚洲AV伊人久久青青草原| 精品一久久香蕉国产线看播放| 97热久久免费频精品99| 久久久久亚洲av无码专区喷水| 国产精品成人久久久| 精品乱码久久久久久夜夜嗨 | 久久人人爽人人人人爽AV| 久久精品中文字幕一区| 国内精品免费久久影院| 久久国产三级无码一区二区| 久久精品国产免费| 国产成人综合久久综合 | 久久国产成人午夜aⅴ影院| 国产成人久久777777| 久久精品国产99久久香蕉| 久久影视国产亚洲| 国产香蕉久久精品综合网| 无码精品久久久天天影视|