Remove unused and potentially error prone constructor from ArrayView

Add as well a SFINAE check to the vector constructor to avoid constructing
an array_view from derived types with a different size.
This commit is contained in:
Maxime Coste 2017-05-26 09:25:25 +01:00
parent 2307cf500c
commit 57ef592f57

View File

@ -31,11 +31,8 @@ public:
template<size_t N> template<size_t N>
constexpr ArrayView(T(&array)[N]) : m_pointer(array), m_size(N) {} constexpr ArrayView(T(&array)[N]) : m_pointer(array), m_size(N) {}
template<typename Iterator> template<typename Alloc, typename U,
constexpr ArrayView(const Iterator& begin, const Iterator& end) typename = typename std::enable_if<sizeof(U) == sizeof(T)>::type>
: m_pointer(&(*begin)), m_size(end - begin) {}
template<typename Alloc, typename U>
constexpr ArrayView(const std::vector<U, Alloc>& v) constexpr ArrayView(const std::vector<U, Alloc>& v)
: m_pointer(&v[0]), m_size(v.size()) {} : m_pointer(&v[0]), m_size(v.size()) {}