diff --git a/gsl/gsl_util b/gsl/gsl_util index 17a1edb..f0ac964 100644 --- a/gsl/gsl_util +++ b/gsl/gsl_util @@ -93,11 +93,19 @@ inline final_act finally(F&& f) noexcept } // narrow_cast(): a searchable way to do narrowing casts of values +#if _MSC_VER <= 1800 template inline constexpr T narrow_cast(U u) noexcept { return static_cast(u); } +#else +template +inline constexpr T narrow_cast(U&& u) noexcept +{ + return static_cast(std::forward(u)); +} +#endif struct narrowing_error : public std::exception {