Adobe Source Libraries 1.49.0
A collection of C++ libraries.
Loading...
Searching...
No Matches

Functions

template<typename T, typename R>
const T & clamp (const T &x, const T &min, const T &max, R r)
 clamp implementation
template<typename T, typename R>
T & clamp (T &x, T &min, T &max, R r)
 clamp implementation
template<typename T>
const T & clamp (const T &x, const T &min, const T &max)
 clamp implementation
template<typename T>
T & clamp (T &x, T &min, T &max)
 clamp implementation
template<typename T, typename R>
const T & clamp_unordered (const T &x, const T &min, const T &max, R r)
 clamp_unordered implementation
template<typename T, typename R>
T & clamp_unordered (T &x, T &min, T &max, R r)
 clamp_unordered implementation
template<typename T>
const T & clamp_unordered (const T &x, const T &min, const T &max)
 clamp_unordered implementation
template<typename T>
T & clamp_unordered (T &x, T &min, T &max)
 clamp_unordered implementation

Detailed Description

As with adobe::min and adobe::max, clamp is a select algorithm. The clamp algorithm returns min if x is less than min and max if x is greater than max.

The clamp algorithm is stable with respect to the order min, x, max.

The clamp_unorderd algorithm does not presume an ordering between min and max. It is equivalent to median(min, x, max).

See also

Function Documentation

◆ clamp() [1/4]

template<typename T, typename R>
const T & clamp ( const T & x,
const T & min,
const T & max,
R r )
Precondition
!r(max, min)

Definition at line 46 of file clamp.hpp.

◆ clamp() [2/4]

template<typename T, typename R>
T & clamp ( T & x,
T & min,
T & max,
R r )
Precondition
!r(max, min)

Definition at line 57 of file clamp.hpp.

◆ clamp() [3/4]

template<typename T>
const T & clamp ( const T & x,
const T & min,
const T & max )
Precondition
!(max < min)

Definition at line 68 of file clamp.hpp.

◆ clamp() [4/4]

template<typename T>
T & clamp ( T & x,
T & min,
T & max )
Precondition
!(max < min)

Definition at line 79 of file clamp.hpp.

◆ clamp_unordered() [1/4]

template<typename T, typename R>
const T & clamp_unordered ( const T & x,
const T & min,
const T & max,
R r )

Definition at line 89 of file clamp.hpp.

◆ clamp_unordered() [2/4]

template<typename T, typename R>
T & clamp_unordered ( T & x,
T & min,
T & max,
R r )

Definition at line 99 of file clamp.hpp.

◆ clamp_unordered() [3/4]

template<typename T>
const T & clamp_unordered ( const T & x,
const T & min,
const T & max )

Definition at line 109 of file clamp.hpp.

◆ clamp_unordered() [4/4]

template<typename T>
T & clamp_unordered ( T & x,
T & min,
T & max )

Definition at line 119 of file clamp.hpp.