<QtMinMax> Proxy Page

函数

const T & qBound (const T & min , const T & val , const T & max )
const T & qMax (const T & a , const T & b )
const T & qMin (const T & a , const T & b )

函数文档编制

[constexpr] template <typename T> const T & qBound (const T & min , const T & val , const T & max )

返回 val bounded by min and max 。这相当于 qMax ( min , qMin ( val , max )).

范例:

int myValue = 10;
int minValue = 2;
int maxValue = 6;
int boundedValue = qBound(minValue, myValue, maxValue);
// boundedValue == 6
					

另请参阅 qMin () 和 qMax ().

[constexpr] template <typename T> const T & qMax (const T & a , const T & b )

Returns the maximum of a and b .

范例:

int myValue = 6;
int yourValue = 4;
int maxValue = qMax(myValue, yourValue);
// maxValue == myValue
					

另请参阅 qMin () 和 qBound ().

[constexpr] template <typename T> const T & qMin (const T & a , const T & b )

Returns the minimum of a and b .

范例:

int myValue = 6;
int yourValue = 4;
int minValue = qMin(myValue, yourValue);
// minValue == yourValue
					

另请参阅 qMax () 和 qBound ().