Version 4.0.0 of Microsoft's implementation of the C++ Core Guidelines Support Library (GSL) is now available! This release maintains the safety guarantees that we have always offered, and adds improvements to various parts of the library.
isocpp/CppCoreGuidelines#1680 removed string_span from the C++ Core Guidelines. The recommendation is to use std::string_view, std::span<char> or gsl::span<char> instead. To more closely align Microsoft’s GSL with the C++ Core Guidelines, we deprecated our implementation of string_span and zstring_span, including basic_string_span, basic_zstring_span, and all related types. For the time being, we will continue to provide the <gsl/string_span> header, but it will not be actively worked on or maintained. A table of all supported and unsupported types/features can be found in the README.md.
Removal of <gsl/multi_span>
multi_span, strided_span, and everything else in <gsl/multi_span> were deprecated over a year ago in GSL 3.0.0, and it is time for them and their associated tests to be removed from the library.
Header files dropped the gsl_ prefix
All headers which previously contained a gsl_ prefix in their name have had this prefix removed. For example, <gsl/gsl_algorithm> is now <gsl/algorithm>. The gsl_ prefixed files still exist and pass through to the updated files, but will be removed in a future release.
Changes to not_null
To more closely align Microsoft’s GSL with the C++ Core Guidelines, gsl::not_null now accepts only types which are comparable to nullptr. Previously, it accepted only types which are assignable from nullptr, but this was stricter than what was intended by the Core Guidelines.
The functions make_not_null and make_strict_not_null, and the not_null comparison operators, are now all noexcept.
gsl::span and std::span now use the correct specialization of gsl::at
gsl::span and std::span now have their own separate specializations of gsl::at, to ensure consistent behavior between the two versions of span. Both overloads are included when importing <gsl/span>. The std::span overload can be separately included from <gsl/util>.
GSL will work in environments where exceptions are disabled, with some caveats
gsl::narrow is the only part of the library which may throw exceptions and has been moved into its own header <gsl/narrow>. This header is included in <gsl/gsl> only if exceptions are enabled. This allows users of the library who are working in environments without exceptions to use all of the other components of the library.
Note: gsl::narrow_cast is still in <gsl/util>, since it does not throw exceptions.
Updated compiler support
The list of supported compilers/toolsets has been updated with newer versions. More info on compiler support can be found in the README.md.