Fixed ctors for Container and std::array to accept temporaries.

This commit is contained in:
Neil MacIntosh
2016-03-17 17:20:33 -07:00
parent 717a2e35f1
commit 3d4c34966a
3 changed files with 31 additions and 41 deletions
+1 -1
View File
@@ -2159,8 +2159,8 @@ public:
value_type operator[](difference_type n) const noexcept
{
return (*m_container)[m_itr[n]];
;
}
bool operator==(const general_span_iterator& rhs) const noexcept
{
Expects(m_container == rhs.m_container);
+6 -7
View File
@@ -187,7 +187,7 @@ public:
: storage_(&arr[0], extent_type<N>())
{}
template <size_t N>
template <size_t N, class = std::enable_if_t<is_const<element_type>::value>>
constexpr span(const std::array<std::remove_const_t<element_type>, N>& arr)
: storage_(&arr[0], extent_type<N>())
{}
@@ -201,15 +201,14 @@ public:
>
constexpr span(Container& cont) : span(cont.data(), cont.size()) {}
// NB: the SFINAE here uses .data() as an incomplete/imperfect proxy for the requirement
// on Container to be a contiguous sequence container.
template <class Container,
class = std::enable_if_t<!details::is_span<Container>::value &&
class = std::enable_if_t<std::is_const<element_type>::value &&
!details::is_span<Container>::value &&
std::is_convertible<Container::pointer, pointer>::value &&
std::is_convertible<Container::pointer, decltype(std::declval<Container>().data())>::value>
>
span(const Container&&) = delete;
constexpr span(const Container& cont) : span(cont.data(), cont.size()) {}
constexpr span(const span& other) noexcept = default;
constexpr span(span&& other) noexcept = default;
@@ -232,10 +231,10 @@ public:
{
}
#if 0 // TODO
~span() noexcept = default;
constexpr span& operator=(const span& other) noexcept = default;
constexpr span& operator=(span&& other) noexcept = default;
#if 0 // TODO
// [span.sub], span subviews
template <ptrdiff_t Count>