Developer Guide and Reference



Return the right value if the right value is greater than left, otherwise returns the left value.
#include <sdlt/min_max_val.h>


template<typename T> T max_val(const T left, const T right);
typename T
The type of the left and right values
C++ implementations of std::min and std::max create a conditional control flow that returns references to its parameters, which may cause inefficient vector code generation. max_val is a really simple template that returns by value instead of reference, allowing more efficient vector code to be generated. For most cases the algorithm didn't need a reference to the inputs and a copy by value should suffice. It should inline, adding no overhead. Inside of SIMD loops, we suggest using sdlt::max_val in place of std::max.
Requires < operator be defined for the type T.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at