Skip to content
Snippets Groups Projects
Commit b4c9fa00 authored by Sven Kaulmann's avatar Sven Kaulmann
Browse files

Replaced std::abs by direct computation of absolute value

Necessary because no overloaded version of std::abs
exists for unsigned long long
parent 98f92cb2
No related branches found
No related tags found
No related merge requests found
...@@ -185,7 +185,11 @@ intersectionRange(const Dune::Fem::GridPartInterface<GridPartTraits>& gridpart, ...@@ -185,7 +185,11 @@ intersectionRange(const Dune::Fem::GridPartInterface<GridPartTraits>& gridpart,
template <class T, class sequence = std::vector<T>> template <class T, class sequence = std::vector<T>>
sequence valueRange(const T start, const T end, const T increment = Epsilon<T>::value) sequence valueRange(const T start, const T end, const T increment = Epsilon<T>::value)
{ {
sequence ret(typename sequence::size_type(((end > start) ? end - start : start - end) / std::abs(increment)), start); // 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);
sequence ret(typename sequence::size_type(((end > start) ? end - start : start - end) / incrementAbs), start);
typename sequence::size_type i = 0; typename sequence::size_type i = 0;
std::generate(std::begin(ret), std::end(ret), [&]() { return T(start + (increment * i++)); }); std::generate(std::begin(ret), std::end(ret), [&]() { return T(start + (increment * i++)); });
return ret; return ret;
......
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