zoukankan      html  css  js  c++  java
  • set-equal_range

    ////////////////////////////////////////
    //      2018/04/28 14:04:28
    //      set-equal_range
    #include <iostream>
    #include <set>
    
    using namespace std;
    
    int main(){
        set<int> c;
    
        c.insert(1);
        c.insert(2);
        c.insert(4);
        c.insert(10);
        c.insert(11);
    
    
        // find leftmost node not less than(不小于) _Keyval in mutable tree
        cout << "lower_bound(3):"
            << *c.lower_bound(3) << endl;
    
        // find leftmost node greater than(大于) _Keyval in mutable tree
        cout << "uper_bound(3):"
            << *c.upper_bound(3) << endl;
    
        // find range equivalent to _Keyval in mutable tree
        cout << "equal_range(3):"
            << *c.equal_range(3).first << " " // lower_bound  bpund(弹跳,限制,界限)   
            << *c.equal_range(3).second << endl;   // uper_bound
        cout << endl;
    
    
        cout << "lower_bound(5):"
            << *c.lower_bound(5) << endl;
        cout << "uper_bound(5):"
            << *c.upper_bound(5) << endl;
        cout << "equal_bound(5):"
            << *c.equal_range(5).first << " "
            << *c.equal_range(5).second << endl;
    
        return 0;
    }
    
    /*
    OUTPUT:
        lower_bound(3):4
        uper_bound(3):4
        equal_range(3):4 4
    
        lower_bound(5):10
        uper_bound(5):10
        equal_bound(5):10 10
    */
  • 相关阅读:
    layui多选框
    js获取html5 audio 音频时长方法
    危害程序员职业生涯的三大观念
    选择器
    C++ STL partial_sort
    C++ STL sort
    C++ STL 排列 next_permutation prev_permutation
    C++ STL 逆转旋转 reverse reverse_copy rotate
    C++ unique
    C++ remove remove_if erase
  • 原文地址:https://www.cnblogs.com/laohaozi/p/12537912.html
Copyright © 2011-2022 走看看