gsl-lite – A single-file header-only version of ISO C++ Guidelines Support Library (GSL) for C++98, C++11, and later
This release of gsl lite changes its not_null
towards the same class in Microsoft's GSL (issue #122).
One step that gsl lite does not (yet) take, is to make not_null
's constructor explicit
and thereby inhibit implicit conversions and copy-initialization. gsl lite does however offer a configuration setting via gsl_CONFIG_NOT_NULL_EXPLICIT_CTOR
to make not_null
's constructor explicit
. It also offers not_null_ic
for implicit construction.
Implicit not_null construction:
void use_implicit( not_null<int*> nnp );
void caller_implicit()
{
owner<int*> oip( new int(42) );
use_implicit( oip );
// ...
}
Explicit not_null construction:
void use_explicit( not_null<owner<int*>> nnp );
void caller_explicit()
{
owner<int*> oip( new int(42) );
use_explicit( not_null<owner<int*>>(oip) );
// ...
}
Changes
not_null_ic
with implicit constructor, allowing copy-initialization.gsl_CONFIG_NOT_NULL_EXPLICIT_CTOR
, default 0 (breaking, issue #46).get()
return by const &
via gsl_CONFIG_NOT_NULL_GET_BY_CONST_REF
(via M-GSL PR 651 @xaxxon, PR 675 @ericLemanissier).is_convertible
to is_constructible
(via M-GSL PR 650, @xaxxon).const &
when rvalue references are not available.gsl_HAVE_EXPLICIT
.RefCounted
conversion function const in not_null.t.cpp.This release of gsl lite changes its span
towards proposal p0122r7 and adds non-standard creator function byte_span()
to create a span of bytes for a single object. Further it adds more control over including features or deprecated behaviour.
Additions
gsl_lite_MAJOR
, gsl_lite_MINOR
, gsl_lite_PATCH
, updated script/update-version.py.gsl_CONFIG_DEPRECATE_TO_LEVEL
; default no deprecation.gsl_FEATURE_WITH_CONTAINER_TO_STD
; default any C++ standard.gsl_FEATURE_MAKE_SPAN_TO_STD
; default any C++ standard.gsl_FEATURE_BYTE_SPAN_TO_STD
; default any C++ standard.gsl_DEPRECATE_TO_LEVEL()
, gsl_FEATURE()
, gsl_FEATURE_TO_STD()
,
gsl_CONFIG()
, gsl_HAVE()
and gsl_ADDRESSOF(x)
.span::value_type
.details::can_construct_span_from<>
.span
.make_span( with_container_t, ...)
creator functions.byte_span()
creator functions (span lite issue #3, thanks to @chris0e3).Changes
constexpr
to C++11 constexpr
where possible.min()
, max()
via -DNOMINMAX
in test/t*.bat.This release of gsl lite introduces support for the DJGPP cross compiler. Further it contains the following changes.
Additions
Changes
gsl::byte
(issue #114).FILE: LINE
in reported locations has been removed (issue #112).Fixes
#include <algorithm>
has been added.This release of gsl lite contains the following changes.
Changes
You can now use gsl lite via a CMake package, thanks to @FlorianWolters (PR #100, #103).
The CMake package provides gsl lite as interface library via 'namespaced' headers gsl/gsl
and gsl/gsl-lite.hpp
.
In the documentation, the section on installation now describes using gsl-lite as copied header, as external Git project, as CMake package and as Conan package. Further the section Deprecation was added and the table Reported to work with was updated.
The following methods of class span
are now deprecated: span::length()
, span::length_bytes()
(issue #99) and the span constructors that take a smart pointer, span(shared_ptr<element_type> const & ptr)
, span(unique_ptr<element_type> const & ptr)
(issue #98).
Additions
CMake Package Configuration support has been added. This makes gsl-lite usable with CMake's find_package()
command. To prevent undesired compilation of tests and examples, two CMake options where added that default to off: GSL_LITE_OPT_BUILD_TESTS
and GSL_LITE_OPT_BUILD_EXAMPLES
. To support the usage of gsl-lite's CMake package, scripts script/install-gsl-pkg.py was added as well as script use-gsl-pkg.py that is part of an example that uses the package. Further a script was added to update gsl lite's version number in relevant files.
Type gsl::index
has been added for container indices, subscripts and sizes. It is defined by the existing configuration macro gsl_CONFIG_SPAN_INDEX_TYPE
.
Fixes
In the output stream operator of class string_span
the padding has been fixed to pad to the right side, commit 9574552.
This release of gsl lite contains the following changes.
Changes Travis and Appveyor CI compiler matrices have been expanded. CI now uses the CMake configuration.
Additions
The Visual Studio 2015 and 2017 targets now include variants with compiler option -std:c++14
, -std:c++17
and -std:c++latest
to specify the C++ standard to use.
For the Visual Studio 2017 target C++ Core Guidelines checking has been added. The checking is limited to GSL Lite itself. Thanks to @AraHaan for drawing attention to the guideline checking in PR #95.
A test was added to compare an empty to a non-empty string span. Comparing empty string_span
s as equal asserts with several configurations and is possibly questionable; it has been suppressed via [.]
. See issue #96.
Fixes
The CMake configuration now uses CMAKE_CXX_COMPILER_VERSION
to obtain the compiler's version number instead of a version number obtained from gcc via commandline options -dumpversion
and -dumpfullversion
. The dumped version is a configuration value that is used in filesystem paths. I've noticed erroneous values with it on Travis even in the main version number.
This release of gsl lite contains the following changes.
Changes
The GSL Lite header file now has extension .hpp
. There are headers gsl.h
and gsl/gsl-lite.h
to provide backwards compatibility, however these have been deprecated as of this version. See issue #94 , thanks to @AraHaan.
Several warnings from Microsoft's CppCoreCheck have been suppressed. See pull request #95, thanks to @AraHaan.
There are no additions or fixes in this release.
This release of gsl lite contains the following changes.
Additions
Conan installation instructions and badge were added (thanks to @agauniyal). An install
target has been added to the CMake instructions (issue #85).
Changes
final_act
has been renamed to final_action
(issue #89). Several deleted (or private) methods were added for clang-tidy cppcoreguidelines checks to pass (pull request #91, thanks to @poconbhui).
Fixes
In not_nul::get()
, nullptr
was corrected to gsl_nullptr
(pull request #90, thanks to @poconbhui). A -Wshadow
warning was fixed (pull request #84, thanks to @MikeLankamp).
This release of gsl lite contains the following changes.
Additions
Several deleted operators (issue #82) and comparison operators (issue #83) were added for not_null<>
.
Changes
If possible, owner<T>
is restricted to pointers (issue #80).
As in not_null<>
's constructor, the parameter in the assignment is taken by value. If available, = default
is used for not_null<>
copy construction and copy assignment.
New macros gsl_is_delete
and gsl_is_delete_access
were added to only write such function prototypes once (issue #81).
Fixes
none.
This release of gsl lite adds the implementation of to_byte()
and to_integer()
for C++17 (thanks to David Mugnai, @cinghiale). Further a try it online badge has been added to the Readme.
This release of gsl lite contains the following changes.
Additions
The dereference operator was added to not_null<>
and tests were added for it (issue #73, thanks to @minielim). The hidden tests now also report the compiler version and the C++ language version (run gsl-lite @
).
Changes
The definition of macros that indicate the availability of language and library features was changed to enable the use of option -Wundef
. For the same reason the lest test framework was updated to version 1.30.1.
Fixes
A check for make_unique
was fixed in a test. In the CMake build files compiler selection was fixed as well as setting of common compiler options.