<QtMinMax> | Qt Core | Qt 6.10.3
Description: Functions for limiting a value to lower and/or upper bounds.

- Qt 6.10
- Qt Core
- <QtMinMax>
- Qt 6.10.3 Reference Documentation

# <QtMinMax>

Functions for limiting a value to lower and/or upper bounds. More...

Header: | `#include <QtMinMax>`

## Functions

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)

## Detailed Description

## Function Documentation

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

Returns val bounded by min and max.

Example:

     int myValue = 10;
     int minValue = 2;
     int maxValue = 6;

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

See also qMin() and qMax().

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

Returns the maximum of a and b.

Example:

     int myValue = 6;
     int yourValue = 4;

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

See also qMin() and qBound().

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

Returns the minimum of a and b.

Example:

     int myValue = 6;
     int yourValue = 4;

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

See also qMax() and qBound().