目录

greater_equal

描述 (Description)

它是一个函数对象类,用于大于或等于比较和二元函数对象类,其调用返回其第一个参数是否大于或等于第二个参数(由operator> =返回)。

声明 (Declaration)

以下是std :: greater_equal的声明。

template <class T> struct greater_equal;

C++11

template <class T> struct greater_equal;

参数 (Parameters)

T - 它是函数调用的参数和返回类型的一种类型。

返回值 (Return Value)

没有

异常 (Exceptions)

noexcep - 它不会抛出任何异常。

例子 (Example)

在下面的例子中解释了std :: greater_equal。

#include <iostream>
#include <functional>
#include <algorithm>
int main () {
   int numbers[]={200,-30,10,-40,0};
   int cx = std::count_if (numbers, numbers+5, std::bind2nd(std::greater_equal<int>(),0));
   std::cout << "There are " << cx << " non-negative elements.\n";
   return 0;
}

让我们编译并运行上面的程序,这将产生以下结果 -

There are 3 non-negative elements. 
↑回到顶部↑
WIKI教程 @2018