v1.0.0
gsl-lite v1.0.0
Breaking changes
namespace gsl_lite and <gsl-lite/gsl-lite.hpp>
gsl-lite now lives in the single header file <gsl-lite/gsl-lite.hpp>, and all its symbols reside in namespace gsl_lite. By default, gsl-lite no longer defines a namespace gsl or the unprefixed Expects() and Ensures() macros for precondition and postcondition checking.
This change enables coexistence with Microsoft GSL or other GSL implementations. (#194)
To minimize the impact of the breaking changes, gsl-lite introduces an optional GSL compatibility mode controlled by the new configuration switch gsl_FEATURE_GSL_COMPATIBILITY_MODE, which is is disabled by default and can be enabled by defining gsl_FEATURE_GSL_COMPATIBILITY_MODE=1. This should not be used in public header files of libraries which use gsl-lite because it precludes the use of Microsoft GSL in the same translation unit.
The legacy header file <gsl/gsl-lite.hpp> now forwards to <gsl-lite/gsl-lite.hpp> and implicitly enables the GSL compatibility mode. When the legacy header is included, it emits a warning message which urges to either migrate to header <gsl-lite/gsl-lite.hpp>, namespace gsl_lite, and the prefixed contract checking macros gsl_Expects() and gsl_Ensures(), or to explicitly request GSL compatibility by defining gsl_FEATURE_GSL_COMPATIBILITY_MODE=1.
Please refer to the migration guide in the gsl-lite documentation for guidance on how to adapt your code.
Other changes
-
span<>now implements static extents. This was achieved by adapting thespan<>implementation from Microsoft GSL, back-porting it to support C++98 and older compilers. (#153; 14c9f730efe2d056fb580c15402a93a21cdec01e) -
span<>::iteratornow is a proper class instead of a pointer. Span iterator operations are now checked withgsl_ExpectsDebug(). (#153; 14c9f730efe2d056fb580c15402a93a21cdec01e) -
gsl-lite v1 has different defaults for the numerous configuration options and switches:
gsl_FEATURE_STRING_SPAN:
Version-1 default:gsl_FEATURE_STRING_SPAN=0
Version-0 default:gsl_FEATURE_STRING_SPAN=1
Reason: string spans are no longer part of the GSL specification.gsl_FEATURE_BYTE:
Version-1 default:gsl_FEATURE_BYTE=0
Version-0 default:gsl_FEATURE_BYTE=1
Reason:bytehas been superseded bystd::bytein C++17.- : Version-1 default: Version-0 default:
Fixes
- In C++98 mode, the faulty definition of the internal function macro
gsl_STATIC_ASSERT_()was corrected, fixing an unwanted predicate inversion for some internal compile-time checks. (ad2ffbdfec329c66194fa7f4676114f64e8d8cbf) - Contract check macros now always expand to an expression or a statement, which avoids compiler warnings. (4654752fdcd8cf6684360c705c72d8f3d28694ef)
Deprecations and removals
- Deprecated unsafe
span<>member functionas_span<>(). (14c9f730efe2d056fb580c15402a93a21cdec01e) - Removed
Owner()andimplicitmacros, which already were disabled by default. (10952e7e58f542ff741ec329e01427101b309e55) - Removed many deprecated functions: (6163d1366dde01ce0ceff62b0c74b686f8eb698b, 14c9f730efe2d056fb580c15402a93a21cdec01e)
as_writeable_bytes()basic_string_span<>member functionoperator()for indexingspan<>constructor overloads andmake_span()overloads accepting reference arguments,unique_ptr<>, orshared_ptr<>argumentsspan<>member functionsat()andoperator()for indexingspan<>member functionslength(),length_bytes(),as_bytes(),as_writeable_bytes()
- Removed the non-templated functions
finally(),on_return(), andon_error()for C++98. (6bae7681f3bf33f539677b70076fbfba33ee4fd7)
Full Changelog: https://github.com/gsl-lite/gsl-lite/compare/v0.43.0...v1.0.0