extent: quiesce clang abs warnings for unsigned types

This commit is contained in:
Danny Robson 2015-09-09 18:40:07 +10:00
parent 07885819e3
commit 0302df1ba8

View File

@ -26,9 +26,14 @@
template <size_t S, typename T>
util::extent<S,T>::extent (vector<S,T> _v)
{
std::copy (std::begin (_v.data),
std::end (_v.data),
std::begin (this->data));
std::transform (std::begin (_v),
std::end (_v),
this->begin (),
[] (auto i) {
// using std::abs gives unsigned abs warnings under clang. this tricks
// it sufficiently to quiet the warnings.
return i < 0 ? -i : i;
});
}