• <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)
            公告
            日歷
            <2007年5月>
            293012345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789
            統(tǒng)計(jì)
            • 隨筆 - 8
            • 文章 - 91
            • 評(píng)論 - 16
            • 引用 - 0

            導(dǎo)航

            常用鏈接

            留言簿(4)

            隨筆分類(lèi)(4)

            隨筆檔案(8)

            文章分類(lèi)(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)各類(lèi)型的范圍
            #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) 評(píng)論(1)  編輯 收藏 引用 所屬分類(lèi): STL/BOOST
            評(píng)論:
             
            Copyright © 笑笑生 Powered by: 博客園 模板提供:滬江博客
            国内精品久久久久影院日本 | 久久只有这精品99| 亚洲精品美女久久久久99小说| 香蕉99久久国产综合精品宅男自 | 久久久国产精华液| 久久久久人妻一区精品色| 久久久久女人精品毛片| 99热成人精品热久久669| 久久毛片免费看一区二区三区| 久久人做人爽一区二区三区| 国产亚洲成人久久| 人妻无码中文久久久久专区| 久久精品免费网站网| 久久se精品一区二区| 一本色道久久综合狠狠躁| 久久99热这里只有精品国产| 成人国内精品久久久久一区| 伊人情人综合成人久久网小说| 国产午夜精品久久久久九九电影| 久久久女人与动物群交毛片| 久久99这里只有精品国产| 国产福利电影一区二区三区久久老子无码午夜伦不 | 久久午夜夜伦鲁鲁片免费无码影视| 久久精品www人人爽人人| 久久精品综合网| 久久夜色精品国产噜噜亚洲a| 久久天天躁狠狠躁夜夜2020老熟妇| 99久久精品免费看国产| 久久96国产精品久久久| 九九久久自然熟的香蕉图片| 亚洲AV无码1区2区久久| 久久久久久伊人高潮影院| 久久久久久久97| 久久妇女高潮几次MBA| 久久免费看黄a级毛片| 久久影院亚洲一区| 久久99这里只有精品国产| 久久妇女高潮几次MBA| 久久亚洲精品人成综合网| 久久久久久久亚洲Av无码| 国产亚洲欧美成人久久片|