For span, fix size_t to index_type conversion warning.

Use narrow per discussion instead of static_cast.
This commit is contained in:
Gary Furnish 2016-10-04 21:13:18 -06:00
parent 023652e304
commit 612747a5e1

View File

@ -392,7 +392,7 @@ public:
std::is_convertible<typename Container::pointer, pointer>::value && std::is_convertible<typename Container::pointer, pointer>::value &&
std::is_convertible<typename Container::pointer, std::is_convertible<typename Container::pointer,
decltype(std::declval<Container>().data())>::value>> decltype(std::declval<Container>().data())>::value>>
constexpr span(Container& cont) : span(cont.data(), cont.size()) constexpr span(Container& cont) : span(cont.data(), narrow<index_type>(cont.size()))
{ {
} }
@ -402,7 +402,7 @@ public:
std::is_convertible<typename Container::pointer, pointer>::value && std::is_convertible<typename Container::pointer, pointer>::value &&
std::is_convertible<typename Container::pointer, std::is_convertible<typename Container::pointer,
decltype(std::declval<Container>().data())>::value>> decltype(std::declval<Container>().data())>::value>>
constexpr span(const Container& cont) : span(cont.data(), cont.size()) constexpr span(const Container& cont) : span(cont.data(), narrow<index_type>(cont.size()))
{ {
} }