From 0d9a74bb6d9406e438308a801a231c4699a6c8bf Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Mon, 18 Mar 2019 10:48:23 +0100 Subject: [PATCH] Fix for ugly code. --- src/libslic3r/SLA/SLASupportTree.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/SLA/SLASupportTree.cpp b/src/libslic3r/SLA/SLASupportTree.cpp index 437f07fcb..a5fcaf3f3 100644 --- a/src/libslic3r/SLA/SLASupportTree.cpp +++ b/src/libslic3r/SLA/SLASupportTree.cpp @@ -755,9 +755,12 @@ public: return m_compact_bridges; } - template inline - typename std::enable_if::value, const Pillar&>::type - pillar(T id) const { assert(id >= 0); return m_pillars.at(size_t(id)); } + template inline const Pillar& pillar(T id) const { + static_assert(std::is_integral::value, "Invalid index type"); + assert(id >= 0 && id < m_pillars.size() && + id < std::numerix_limits::max()); + return m_pillars[size_t(id)]; + } const Pad& create_pad(const TriangleMesh& object_supports, const ExPolygons& baseplate,