mirror of
https://github.com/microsoft/GSL.git
synced 2025-11-18 08:19:37 +01:00
Fixed a bug on creating a span from empty string
This commit is contained in:
@@ -270,7 +270,7 @@ public:
|
|||||||
|
|
||||||
// from string
|
// from string
|
||||||
constexpr basic_string_span(std::string& s) noexcept
|
constexpr basic_string_span(std::string& s) noexcept
|
||||||
: span_(&(s.at(0)), narrow_cast<std::ptrdiff_t>(s.length()))
|
: span_(const_cast<pointer>(s.data()), narrow_cast<std::ptrdiff_t>(s.length()))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
// from containers. Containers must have .size() and .data() function signatures
|
// from containers. Containers must have .size() and .data() function signatures
|
||||||
|
|||||||
Reference in New Issue
Block a user