gsl-lite – A single-file header-only version of ISO C++ Guidelines Support Library (GSL) for C++98, C++11, and later
Additions:
gsl_CPP23_OR_GREATER
, CONSTEXPR_23
language feature, and gsl_constexpr23
keyword macro (#329)gsl_CONFIG_VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS
config switch for suppressing the compile-time syntax validation of contract check expressions (#330)Changes:
string_span
and zstring_span
and prepare for removal (#335)Fixes:
__builtin_assume()
for gsl_ASSUME_()
in device code (#324, thanks to @codecircuit)not_null_ic<>
copy construction (#326, thanks to @runer112)wchar_t
(#331, thanks to @burnpanck)Additions:
gsl_ExpectsDebug()
, gsl_EnsuresDebug()
, gsl_AssertDebug()
which are sensitive
to the NDEBUG
macro, and thus similar to assert()
(#316)gsl_CONFIG_DEVICE_CONTRACT_CHECKING_AUDIT
/ON
/OFF
,
gsl_CONFIG_DEVICE_CONTRACT_VIOLATION_ASSERTS
/TRAPS
/CALLS_HANDLER
, and
gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME
/ELIDE
(#317)gsl::is_valid()
for explicitly detecting the moved-from state of a gsl::not_null<>
object (#318)gsl_DEVICE_CODE
(evaluates to 1 when compiling CUDA device code, 0 when compiling host code)Changes:
Fixes:
gsl::
target rather than nonexistent gsl-lite::
target in Config.cmake (#315, thanks to @Ram-Z)Additions:
gsl::make_unique<T>()
and gsl::make_shared<T>()
which resemble the eponymous functions from std
but return
gsl::not_null<std::unique_ptr<T>>
and gsl::not_null<std::shared_ptr<T>>
(#312)Changes:
std98::equal()
, std98::lexicographical_compare()
from public interface (#313)Fixes:
gsl::not_null<std::shared_ptr<T>>
now correctly converts to std::weak_ptr<T>
(#311, thanks to @stohrendorf)Additions:
gsl_HAVE( C99_PREPROCESSOR )
gsl_CONSTRAINT()
which can be used to impose concept requirements on template type parameters in a backward-compatible manner:
template< gsl_CONSTRAINT(Concept) T >
expands to template< Concept T >
for C++20 and to template< typename T >
otherwisestd20::endian()
(#305)Changes:
Fixes:
constexpr
support for span<>
; add constexpr
tests (#306)Additions:
gsl_Assert()
, gsl_AssertAudit()
to express checks which are neither pre- nor postconditions (#294)gsl_FailFast()
which is guaranteed to terminate normal execution in some way
(exception, std::terminate()
, or trap instruction) (#294)gsl_CONFIG_CONTRACT_VIOLATION_TRAPS
which makes gsl_Expects()
/gsl_Ensures()
/gsl_Assert()
(and
the Audit
variants if audit mode is enabled) and gsl_FailFast()
execute a trap instruction in case of a contract violationgsl_CONFIG_CONTRACT_VIOLATION_ASSERTS
which implements gsl_Expects()
/gsl_Ensures()
/gsl_Assert()
(and the Audit
variants if audit mode is enabled) in terms of the assert()
macro from the standard library. This has the
benefits that both legacy assertions and contract checks can be globally suppressed with a single macro (NDEBUG
), and that
assert()
prints an informative error message which contains the contract check expression.as_nullable()
function (#251, thanks to @petamas)std::hash<>
specialization for not_null<>
(#297; thanks to @mbs-c)gsl_STDLIB_CPPxx_OR_GREATER
indicate availability of the standard librarygsl_HAVE( HASH )
, gsl_HAVE( MOVE_FORWARD )
, gsl_HAVE( OVERRIDE_FINAL )
size_type
to span<>
and basic_string_span<>
Changes:
gsl_HAVE()
, gsl_CONFIG()
, gsl_FEATURE()
with unknown arguments now causes compilation errors (#272)narrow<>()
now issues a static_assert()
that refers to narrow_failfast<>()
if exceptions are unavailable (#269)not_null<>
now has a specialization for raw pointers which avoids unnecessary contract checks (#300)gsl_CONFIG_CONTRACT_VIOLATION_THROWS
modenarrowing_error
now produces a less unhelpful exception message ("narrowing_error")gsl_noexcept
now falls back to throw()
if noexcept
is unavailablenamespace gsl
and namespace gsl_lite
to ease migrationnot_null_ic<>
is now also visible in namespace gsl_lite
(#280; thanks to @woodsking2)nullptr_t
comparison operators for not_null<>
are now explicitly deletedgsl_NODISCARD
throughout the library__builtin_unreachable()
intrinsic in gsl_CONFIG_UNENFORCED_CONTRACTS_ASSUME
modeFixes:
Additions:
gsl_CONFIG_NARROW_THROWS_ON_TRUNCATION
gsl_CONFIG_ALLOWS_SPAN_COMPARISON
narrow_failfast<>()
, a fast-fail variant of narrow<>()
(#52)front()
and back()
to span<>
and basic_string_span<>
(#241, thanks to @ned14)Changes:
as_writeable_bytes()
-> as_writable_bytes()
to follow C++20 in spelling; the old name is still provided for compatibilitygsl_DEPRECATED()
-> gsl_DEPRECATED_MSG()
, add gsl_DEPRECATED
gsl_DEPRECATED()
annotationsspan<>::at()
, basic_string_span<>::at()
, and call indexinggsl_ENABLE_IF_()
(#238; thanks to @martinmoene)narrow<>()
and narrow_failfast<>()
Fixes:
gsl_CONFIG_CONTRACT_CHECKING_OFF
is definedspan<>
constrained constructor (#242, thanks to @orangeturtle739)gsl::detail::is_compatible_container<>
a proper type traitThe repository now moved to a dedicated GitHub organization: https://github.com/gsl-lite/gsl-lite
gsl-lite is now mostly maintained by @mbeutel (#175).
Additions:
gsl_ExpectsAudit()
and gsl_EnsuresAudit()
(#172)basic_zstring_span<>
and zstring_span
(#136, #154, thanks to @chan-lee)fail_fast_assert_handler()
gsl_NORETURN
, gsl_NODISCARD
, gsl_DEPRECATED()
, gsl_constexpr17
, gsl_constexpr20
gsl::std11
: remove_reference<>
gsl::std17
: conjunction<>
, disjunction<>
, negation<>
, void_t<>
gsl::std20
: identity
, type_identity<>
, ssize()
(#144, #180), remove_cvref<>
gsl_CONFIG_TRANSPARENT_NOT_NULL
(#185)gsl_CONFIG_INDEX_TYPE
which controls the type of gsl::index
independently of gsl::span<>::index_type
(#169)gsl_HAVE_EXCEPTIONS
gsl_DEFINE_ENUM_BITMASK_OPERATORS()
and gsl_DEFINE_ENUM_RELATIONAL_OPERATORS()
gsl_lite
to pave the way for future coexistence with M-GSL (#221, #222), cf. Using gsl-lite in libraries
Changes:
not_null<>
now properly supports smart pointers (#184, #197; huge thanks to @petamas)gsl_noexcept
no longer depends on contract violation settings (cf. https://github.com/martinmoene/gsl-lite/commit/0c296a9c986ac070997610fc7cf86e9c517558bf)gsl_FEATURE_IMPLICIT_MACRO
now defaults to 0 (#156, thanks to @tadeu)gsl_COMPILER_APPLECLANG_VERSION
for checking)This release of gsl lite changes the CMake package folder name to gsl-lite
(it was gsl
) and it adds a usage description for the Conda package manager to the Readme.
Further macro gsl_REQUIRES_T()
was introduced (nonstd lite issue 18) and the lest test framework has been updated to v1.35.1
This release of gsl lite has changes that originate from the nonstd-lite project and quite a few fixes by its users.
Additions
-Wsign-conversion
warning to CMake configurationspan::ssize()
, ssize(span)
, size(span)
(#144)Changes
-DNOMINMAX
with MSVC (nonstd-lite issue 16)Fixes
not_null<>
comparison operators (#143, thanks @stohrendorf)gsl_IN_STD
(#142, thanks to @Flamefire)nonstd::span::subspan()
range (issue #138, thanks to @fefe17)__cplusplus
of GCC 4.7.0 and earlier (#127, thanks to @egarrulo)final_action_return()
and final_action_error()
during stack unwinding (#126, thanks to @patstew)Expects()
elided via new macro gsl_EXPECTS_UNUSED_PARAM
(#123, #124, thanks to @kugelrund)