simplified constructors and removed GSL_NOEXCEPT in span (#639)

- simplified storage constructors to reduce branching
- eliminated null check for constructor from array
- removed GSL_NOEXCEPT in span
This commit is contained in:
Anna Gringauze
2018-03-15 12:14:29 -07:00
committed by GitHub
parent c9e423d7cf
commit c6bf25a5f6
2 changed files with 60 additions and 50 deletions

View File

@ -417,9 +417,8 @@ public:
constexpr string_span_type as_string_span() const GSL_NOEXCEPT
{
auto sz = span_.size();
return span_.first(sz <= 0 ? 0 : sz - 1);
return { span_.data(), sz > 1 ? sz - 1 : 0 };
}
constexpr string_span_type ensure_z() const GSL_NOEXCEPT { return gsl::ensure_z(span_); }
constexpr const_zstring_type assume_z() const GSL_NOEXCEPT { return span_.data(); }