lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
util Namespace Reference

Small generic helpers that return the common type of their arguments. More...

Functions

template<typename A , typename B >
std::common_type< A, B >::type min (const A &a, const B &b)
 Return the smaller of a and b (b if they compare equal), as their common type.
 
template<typename A , typename B >
std::common_type< A, B >::type max (const A &a, const B &b)
 Return the larger of a and b (b if they compare equal), as their common type.
 
template<typename A , typename B , typename C >
std::common_type< A, B, C >::type clamp (const A &val, const B &lower, const C &upper)
 Return val limited to the range from lower to upper, as the common type of the three arguments.
 

Detailed Description

Small generic helpers that return the common type of their arguments.

Function Documentation

◆ clamp()

template<typename A , typename B , typename C >
std::common_type< A, B, C >::type util::clamp ( const A &  val,
const B &  lower,
const C &  upper 
)

Return val limited to the range from lower to upper, as the common type of the three arguments.

◆ max()

template<typename A , typename B >
std::common_type< A, B >::type util::max ( const A &  a,
const B &  b 
)

Return the larger of a and b (b if they compare equal), as their common type.

◆ min()

template<typename A , typename B >
std::common_type< A, B >::type util::min ( const A &  a,
const B &  b 
)

Return the smaller of a and b (b if they compare equal), as their common type.