From 436dbad8c609db8467a7622cda0b1d1541b7b212 Mon Sep 17 00:00:00 2001 From: paweldac Date: Tue, 28 Nov 2017 16:15:34 +0100 Subject: [PATCH] Remove std::iterator inheritance from multi_span (#591) In C++17 std::iterator is marked duplicated. Added handwritten usigs for traits. --- include/gsl/multi_span | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/include/gsl/multi_span b/include/gsl/multi_span index cdde594..dbca3a4 100644 --- a/include/gsl/multi_span +++ b/include/gsl/multi_span @@ -806,17 +806,15 @@ struct is_bounds> : std::integral_constant }; template -class bounds_iterator : public std::iterator +class bounds_iterator { -private: - using Base = std::iterator; - public: static const std::size_t rank = IndexType::rank; - using typename Base::reference; - using typename Base::pointer; - using typename Base::difference_type; - using typename Base::value_type; + using iterator_category = std::random_access_iterator_tag; + using value_type = IndexType; + using difference_type = std::ptrdiff_t; + using pointer = value_type*; + using reference = value_type&; using index_type = value_type; using index_size_type = typename IndexType::value_type; template @@ -1997,14 +1995,13 @@ private: template class contiguous_span_iterator - : public std::iterator { - using Base = std::iterator; - public: - using typename Base::reference; - using typename Base::pointer; - using typename Base::difference_type; + using iterator_category = std::random_access_iterator_tag; + using value_type = typename Span::value_type; + using difference_type = std::ptrdiff_t; + using pointer = value_type*; + using reference = value_type&; private: template @@ -2117,15 +2114,13 @@ contiguous_span_iterator operator+(typename contiguous_span_iterator template class general_span_iterator - : public std::iterator { - using Base = std::iterator; - public: - using typename Base::reference; - using typename Base::pointer; - using typename Base::difference_type; - using typename Base::value_type; + using iterator_category = std::random_access_iterator_tag; + using value_type = typename Span::value_type; + using difference_type = std::ptrdiff_t; + using pointer = value_type*; + using reference = value_type&; private: template