15 template <
typename TTrg,
typename TSrc,
bool u1,
bool u2>
21 static constexpr TTrg trgMinVal = std::numeric_limits<TTrg>::lowest();
22 static constexpr TTrg trgMaxVal = std::numeric_limits<TTrg>::max();
24 using max_type =
typename std::common_type<TTrg, TSrc>::type;
26 if (
static_cast<max_type
>(src) >=
static_cast<max_type
>(trgMaxVal))
30 else if (
static_cast<max_type
>(src) <=
static_cast<max_type
>(trgMinVal))
36 return static_cast<TTrg
>(src);
41 template <
typename TTrg,
typename TSrc>
46 static constexpr TTrg trgMinVal = std::numeric_limits<TTrg>::lowest();
47 static constexpr TTrg trgMaxVal = std::numeric_limits<TTrg>::max();
49 using max_type =
typename std::common_type<TTrg, TSrc>::type;
57 if (
static_cast<max_type
>(src) >
static_cast<max_type
>(trgMaxVal))
63 return static_cast<TTrg
>(src);
68 template <
typename TTrg,
typename TSrc>
73 static constexpr TTrg trgMaxVal = std::numeric_limits<TTrg>::max();
75 using max_type =
typename std::common_type<TTrg, TSrc>::type;
78 if (
static_cast<max_type
>(src) >
static_cast<max_type
>(trgMaxVal))
84 return static_cast<TTrg
>(src);
93 template <
typename TTrg,
typename TSrc>
107 template <
typename TSrc>
116 template <
typename TTrg,
typename TSrc>