If available, use constexpr if

This commit is contained in:
Juha Reunanen 2019-11-12 07:21:34 +02:00
parent 7cf7152993
commit 503d4dd335

View File

@ -867,7 +867,11 @@ namespace dlib
const auto convert_to_output_type = [](float value)
{
if (std::is_integral<T>::value)
if
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
constexpr
#endif // __cplusplus >= 201703L
(std::is_integral<T>::value)
return static_cast<T>(value + 0.5);
else
return static_cast<T>(value);