Skip to content
Snippets Groups Projects
Commit eb15620e authored by René Fritze's avatar René Fritze
Browse files

[common] generalize valueRange check

parent 30db916e
No related branches found
No related tags found
No related merge requests found
......@@ -188,7 +188,7 @@ sequence valueRange(const T start, const T end, const T increment = Epsilon<T>::
// sadly, no overloaded version of std::abs is available for
// unsigned long long, so we compute the absolute value of increment
// ourselfs
T incrementAbs = (increment >= T() ? increment : -increment);
const T incrementAbs = std::is_unsigned<T>::value ? increment : std::abs(increment);
sequence ret(typename sequence::size_type(((end > start) ? end - start : start - end) / incrementAbs), start);
typename sequence::size_type i = 0;
std::generate(std::begin(ret), std::end(ret), [&]() { return T(start + (increment * i++)); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment