From c2f953f2eb7ab501325a7ec5656b400d54b8a345 Mon Sep 17 00:00:00 2001 From: "Maciej T. Nowak" Date: Thu, 13 Apr 2017 22:55:20 +0200 Subject: [PATCH] Add value_type to span (#425) * Add value_type to span Currently I'm working on project which involves a lot of `span`s and mocking via Google Mock. Unfortunately a lot of standard matchers requires `value_type` type definition inside container which `gsl::span` lacks. This pull request add `value_type` type definition inside `gsl::span` * Strip cv from value_type of span and span_iterator --- include/gsl/span | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/gsl/span b/include/gsl/span index 957c9e6..3a8d31d 100644 --- a/include/gsl/span +++ b/include/gsl/span @@ -133,7 +133,7 @@ namespace details using element_type_ = typename Span::element_type; public: using iterator_category = std::random_access_iterator_tag; - using value_type = std::remove_const_t; + using value_type = std::remove_cv_t; using difference_type = typename Span::index_type; using reference = @@ -337,6 +337,7 @@ class span public: // constants and types using element_type = ElementType; + using value_type = std::remove_cv_t; using index_type = std::ptrdiff_t; using pointer = element_type*; using reference = element_type&; @@ -346,6 +347,8 @@ public: using reverse_iterator = std::reverse_iterator; using const_reverse_iterator = std::reverse_iterator; + using size_type = index_type; + constexpr static const index_type extent = Extent; // [span.cons], span constructors, copy, assignment, and destructor