Add static assert instead of returning empty result.
This commit is contained in:
parent
0d83c7ee9f
commit
5abf64e1d2
1 changed files with 6 additions and 4 deletions
|
@ -191,17 +191,19 @@ public:
|
||||||
template<class Key> Range<SliceRecordConstIterator>
|
template<class Key> Range<SliceRecordConstIterator>
|
||||||
get_slice_records(Key from, Key to = std::numeric_limits<Key>::max()) const
|
get_slice_records(Key from, Key to = std::numeric_limits<Key>::max()) const
|
||||||
{
|
{
|
||||||
|
static_assert (std::is_integral<Key>::value ||
|
||||||
|
std::is_floating_point<Key>::value,
|
||||||
|
"Only floating point or integral types are allowed.");
|
||||||
|
|
||||||
SliceIndex::const_iterator it_from, it_to;
|
SliceIndex::const_iterator it_from, it_to;
|
||||||
|
|
||||||
if(std::is_integral<Key>::value) {
|
if(std::is_integral<Key>::value) {
|
||||||
it_from = search_slice_index(SliceRecord::Key(from));
|
it_from = search_slice_index(SliceRecord::Key(from));
|
||||||
it_to = search_slice_index(SliceRecord::Key(to));
|
it_to = search_slice_index(SliceRecord::Key(to));
|
||||||
} else if(std::is_floating_point<Key>::value) {
|
} else if(std::is_floating_point<Key>::value) {
|
||||||
it_from = search_slice_index(float(from));
|
it_from = search_slice_index(float(from));
|
||||||
it_to = search_slice_index(float(to));
|
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();
|
auto start = m_slice_index.begin();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue