epicsAlgorithm.h

Contains a few templates out of the C++ standard header algorithm.

Deprecated:

Use std::min()/max()/swap() in new code

Author

Jeff Hill & Andrew Johnson

Functions

template<class T>
inline const T &epicsMin(const T &a, const T &b)

Returns the smaller of a or b compared using a<b.

template<>
inline const float &epicsMin(const float &a, const float &b)

Returns the smaller of a or b compared using a<b.

Note

If b is a NaN the above template returns a, but should return NaN. These specializations ensure that epicsMin(x,NaN) == NaN

template<>
inline const double &epicsMin(const double &a, const double &b)

Returns the smaller of a or b compared using a<b.

Note

If b is a NaN the above template returns a, but should return NaN. These specializations ensure that epicsMin(x,NaN) == NaN

template<class T>
inline const T &epicsMax(const T &a, const T &b)

Returns the larger of a or b compared using a<b.

template<>
inline const float &epicsMax(const float &a, const float &b)

Returns the larger of a or b compared using a<b.

Note

If b is a NaN the above template returns a, but should return NaN. These specializations ensure that epicsMax(x,NaN) == NaN

template<>
inline const double &epicsMax(const double &a, const double &b)

Returns the larger of a or b compared using a<b.

Note

If b is a NaN the above template returns a, but should return NaN. These specializations ensure that epicsMax(x,NaN) == NaN

template<class T>
inline void epicsSwap(T &a, T &b)

Swaps the values of a and b.

Note

The data type must support both copy-construction and assignment.