Added explicit cast to size_type in span constructor

This silences implicit sign conversion warnings when constructing span
from containers which return size_t from size().
This commit is contained in:
Matus Chochlik 2015-11-18 17:43:59 +01:00
parent 3cd0d523b6
commit da75d0e757

View File

@ -1267,7 +1267,7 @@ public:
&& std::is_convertible<DataType (*)[], value_type (*)[]>::value
&& std::is_same<std::decay_t<decltype(std::declval<Cont>().size(), *std::declval<Cont>().data())>, DataType>::value>
>
constexpr span (Cont& cont) : span(static_cast<pointer>(cont.data()), details::newBoundsHelper<bounds_type>(cont.size()))
constexpr span (Cont& cont) : span(static_cast<pointer>(cont.data()), details::newBoundsHelper<bounds_type>(static_cast<size_type>(cont.size())))
{}
constexpr span(const span &) = default;