描述
它是一個函數對象類,用於 less-than-or-equal-to 比較和二元函數對象類,其調用返回其第一個參數是否小於或等於第二個參數(由運算符 <= 返回)。
聲明
以下是 std::less_equal 的聲明。
template <class T> struct less_equal;
C++11
template <class T> struct less_equal;
參數
T- 它是函數調用的參數和返回類型的類型。
返回值
空
異常
noexcep- 它不會拋出任何異常。
示例
在下麵的例子中解釋了 std::less_equal。
#include <iostream>
#include <functional>
#include <algorithm>
int main () {
int numbers[]={250,500,70,100,125};
int cx = std::count_if (numbers, numbers+5, std::bind2nd(std::less_equal<int>(),100));
std::cout << "There are " << cx << " elements lower than or equal to 100.\n";
return 0;
}
讓我們編譯並運行上麵的程序,這將產生以下結果 -
There are 2 elements lower than or equal to 100
相關用法
- C# logical_and用法及代碼示例
- C# logical_not用法及代碼示例
- C# logical_or用法及代碼示例
- C# Decimal.FromOACurrency()用法及代碼示例
- C# Int32.CompareTo用法及代碼示例
- C# UInt64.ToString()用法及代碼示例
- C# Type.GetTypeHandle()用法及代碼示例
- C# Uri.IsBaseOf()用法及代碼示例
- C# String.ToUpperInvariant用法及代碼示例
- C# File.Copy(String, String, Boolean)用法及代碼示例
- C# Uri.IsHexEncoding()用法及代碼示例
- C# Char.TryParse()用法及代碼示例
- C# Math Cosh()用法及代碼示例
- C# Int64.Equals用法及代碼示例
- C# Convert.ToInt16(String, IFormatProvider)用法及代碼示例
- C# DateTimeOffset.FromUnixTimeMilliseconds()用法及代碼示例
- C# StringBuilder.ToString用法及代碼示例
- C# DateTimeOffset.AddMinutes()用法及代碼示例
- C# MathF.Log10()用法及代碼示例
- C# TimeSpan Subtract()用法及代碼示例
注:本文由純淨天空篩選整理自 C++ Functional Library - less_equal。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。