Advertisement

C++11 <less, greater> 的用法

阅读量:
复制代码
    #include <algorithm>
    #include <functional>
    #include <limits>
    #include <set>
    #include <iostream>
    
    #include <vector>
    using namespace std;
    
    /*
    template <class T> struct less{
      bool operator()(const T& x, const T& y) { return x < y};
    }
    
    template <class T> struct greater{
      bool operator()(const T& x, const T& y) { return x > y};
    }*/
    
    int main()
    {
      std::multiset<double, std::greater<double>> right_bounds;
      right_bounds.insert(std::numeric_limits<double>::lowest());
      right_bounds.insert(1.0);
      ri

全部评论 (0)

还没有任何评论哟~