From e19f6b5f362aac677b369b9e2b46010df13cf944 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Mon, 7 Dec 2015 15:22:11 -0800 Subject: [PATCH] Fixed a bug on creating a span from empty string --- include/string_span.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/string_span.h b/include/string_span.h index 6b0b32b..d3419ee 100644 --- a/include/string_span.h +++ b/include/string_span.h @@ -270,7 +270,7 @@ public: // from string constexpr basic_string_span(std::string& s) noexcept - : span_(&(s.at(0)), narrow_cast(s.length())) + : span_(const_cast(s.data()), narrow_cast(s.length())) {} // from containers. Containers must have .size() and .data() function signatures