From 5abf64e1d2b93a7badd4db65d5e2bc19d44838ab Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Mon, 25 Mar 2019 10:35:42 +0100 Subject: [PATCH] Add static assert instead of returning empty result. --- src/libslic3r/SLAPrint.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/SLAPrint.hpp b/src/libslic3r/SLAPrint.hpp index a22696032..8c7a0fa97 100644 --- a/src/libslic3r/SLAPrint.hpp +++ b/src/libslic3r/SLAPrint.hpp @@ -191,17 +191,19 @@ public: template Range get_slice_records(Key from, Key to = std::numeric_limits::max()) const { + static_assert (std::is_integral::value || + std::is_floating_point::value, + "Only floating point or integral types are allowed."); + SliceIndex::const_iterator it_from, it_to; + if(std::is_integral::value) { it_from = search_slice_index(SliceRecord::Key(from)); it_to = search_slice_index(SliceRecord::Key(to)); } else if(std::is_floating_point::value) { it_from = search_slice_index(float(from)); it_to = search_slice_index(float(to)); - } else return { - SliceRecordConstIterator(m_slice_index, _SliceRecord::NONE ), - SliceRecordConstIterator(m_slice_index, _SliceRecord::NONE ), - }; + } auto start = m_slice_index.begin();