From 9ffd294f072c55e8afa04fc78e44354abf262544 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 17 Jun 2019 09:28:41 +0200 Subject: [PATCH] Fixed functions declaration template inline constexpr coord_t scaled(Tf val) and template inline constexpr Tf unscaled(coord_t val) to use constexpr on versions of Visual Studio which support it --- src/libslic3r/libslic3r.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libslic3r/libslic3r.h b/src/libslic3r/libslic3r.h index e1d247894..c95c95c1a 100644 --- a/src/libslic3r/libslic3r.h +++ b/src/libslic3r/libslic3r.h @@ -49,13 +49,21 @@ typedef double coordf_t; //inline coord_t scale_(coordf_t v) { return coord_t(floor(v / SCALING_FACTOR + 0.5f)); } #define scale_(val) ((val) / SCALING_FACTOR) +#if defined(_MSC_VER) && (_MSC_VER < 1910) +template inline coord_t scaled(Tf val) +#else template inline constexpr coord_t scaled(Tf val) +#endif // _MSC_VER { static_assert (std::is_floating_point::value, "Floating point only"); return coord_t(val / Tf(SCALING_FACTOR)); } +#if defined(_MSC_VER) && (_MSC_VER < 1910) +template inline Tf unscaled(coord_t val) +#else template inline constexpr Tf unscaled(coord_t val) +#endif // _MSC_VER { static_assert (std::is_floating_point::value, "Floating point only"); return Tf(val * Tf(SCALING_FACTOR));