diff options
author | Maciej T. Nowak <maciejt.nowak@gmail.com> | 2017-04-13 22:55:20 +0200 |
---|---|---|
committer | Neil MacIntosh <neilmac@microsoft.com> | 2017-04-13 13:55:20 -0700 |
commit | c2f953f2eb7ab501325a7ec5656b400d54b8a345 (patch) | |
tree | abcc896a976d8207b452376fc14574ab7c021d05 | |
parent | 66cf6896e54d7fec5acf14457499fdb7a409a545 (diff) | |
download | platform_external_Microsoft-GSL-c2f953f2eb7ab501325a7ec5656b400d54b8a345.tar.gz platform_external_Microsoft-GSL-c2f953f2eb7ab501325a7ec5656b400d54b8a345.tar.bz2 platform_external_Microsoft-GSL-c2f953f2eb7ab501325a7ec5656b400d54b8a345.zip |
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
-rw-r--r-- | include/gsl/span | 5 |
1 files changed, 4 insertions, 1 deletions
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<element_type_>; + using value_type = std::remove_cv_t<element_type_>; 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<ElementType>; 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<iterator>; using const_reverse_iterator = std::reverse_iterator<const_iterator>; + using size_type = index_type; + constexpr static const index_type extent = Extent; // [span.cons], span constructors, copy, assignment, and destructor |