From de6dbacbf6debb96297f4c554473069b8a3edb4c Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Tue, 1 Dec 2015 13:52:01 -0800 Subject: [PATCH] Addressed CR comments --- include/string_span.h | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/include/string_span.h b/include/string_span.h index b6dce6b..cc87068 100644 --- a/include/string_span.h +++ b/include/string_span.h @@ -336,16 +336,16 @@ public: return{ span_.last(count) }; } - // Count elements starting from Offset + // create a subview of Count elements starting from Offset template - constexpr basic_string_span sub() const noexcept + constexpr basic_string_span subspan() const noexcept { - return{ span_.template sub() }; + return{ span_.template subspan() }; } - constexpr basic_string_span sub(size_type offset, size_type count = dynamic_range) const noexcept + constexpr basic_string_span subspan(size_type offset, size_type count = dynamic_range) const noexcept { - return{ span_.sub(offset, count) }; + return{ span_.subspan(offset, count) }; } constexpr reference operator[](size_type idx) const noexcept @@ -358,19 +358,28 @@ public: return span_.data(); } + // length of the span in elements constexpr size_type length() const noexcept { return span_.size(); } + // length of the span in elements constexpr size_type size() const noexcept { return span_.size(); } - constexpr size_type bytes() const noexcept + // length of the span in bytes + constexpr size_type size_bytes() const noexcept { - return span_.bytes(); + return span_.size_bytes(); + } + + // length of the span in bytes + constexpr size_type length_bytes() const noexcept + { + return span_.length_bytes(); } constexpr iterator begin() const noexcept