Fixes to typedef's for span::const_iterator.

* Don't const-qualify span::const_iterator's value_type
Fixes Microsoft/GSL#434
This commit is contained in:
Eric Niebler 2016-12-09 20:19:50 -08:00 committed by Neil MacIntosh
parent 1a94e77910
commit 9d13cb14c3

View File

@ -140,15 +140,15 @@ namespace details
template <class Span, bool IsConst> template <class Span, bool IsConst>
class span_iterator class span_iterator
{ {
using element_type_ = typename Span::element_type;
public: public:
using iterator_category = std::random_access_iterator_tag; using iterator_category = std::random_access_iterator_tag;
using value_type = using value_type = std::remove_const_t<element_type_>;
std::conditional_t<IsConst, std::add_const_t<typename Span::element_type>,
typename Span::element_type>;
using difference_type = typename Span::index_type; using difference_type = typename Span::index_type;
using pointer = std::add_pointer_t<value_type>; using reference =
using reference = std::add_lvalue_reference_t<value_type>; std::conditional_t<IsConst, const element_type_, element_type_> &;
using pointer = std::add_pointer_t<reference>;
constexpr span_iterator() noexcept : span_iterator(nullptr, 0) {} constexpr span_iterator() noexcept : span_iterator(nullptr, 0) {}