| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
GSL Lite is based on the Microsoft Guidelines Support Library (GSL).
Contents
#include "gsl/gsl-lite.hpp"
using namespace gsl;
int * use( not_null<int *> p )
{
// use p knowing it's not nullptr, NULL or 0.
return p;
}
struct Widget
{
Widget() : owned_ptr( new int(42) ) {}
~Widget() { delete owned_ptr; }
void work() { non_owned_ptr = use( owned_ptr ); }
owner<int *> owned_ptr; // if alias template support
// Owner(int *) owned_ptr; // C++98 up
int * non_owned_ptr;
};
int main()
{
Widget w;
w.work();
}prompt>g++ -std=c++03 -Wall -I../include -o 01-basic.exe 01-basic.cpp && 01-basic.exe
gsl-lite is a single-file header-only variant of Microsoft's implementation of the Guidelines Support Library (GSL) adapted for C++98, C++03. It should also work when compiled as C++11, C++14, C++17.
The Guidelines Support Library (GSL) contains functions and types that are suggested for use by the C++ Core Guidelines maintained by the Standard C++ Foundation. The library includes types like owner<>, not_null<>, span<>, string_span and others.
gsl-lite recognizes when it is compiled for the CUDA platform and decorates functions (methods) with __host__ and __device__. See also section API macro.
gsl-lite uses the MIT license.
gsl-lite has no other dependencies than the C++ standard library.
gsl-lite is a single-file header-only library. There are various ways to use it in your project.
Contents
Put a copy of gsl-lite.hpp located in folder include/gsl directly into the project source tree or somewhere reachable from your project, for example in project-root/include/gsl. If you like to refer to gsl-lite as gsl, also copy the file gsl. A minimal CMake setup using this header might look as follows.
In project root folder:
cmake_minimum_required( VERSION 3.5 FATAL_ERROR )
project( use-gsl-lite LANGUAGES CXX )
# Provide #include access to gsl-lite as 'gsl/gsl' and as 'gsl/gsl-lite.hpp':
set( GSL_LITE_INCLUDE_DIR include ) # adapt as necessary
add_library( gsl INTERFACE )
target_include_directories( gsl INTERFACE ${GSL_LITE_INCLUDE_DIR} )
# Build program from src:
add_subdirectory( src ) In folder src:
cmake_minimum_required( VERSION 3.5 FATAL_ERROR )
project( program-using-gsl-lite LANGUAGES CXX )
# Make program executable:
set( SOURCES main.cpp)
add_executable( program ${SOURCES} )
target_link_libraries( program PRIVATE gsl )Another approach is to automatically fetch the entire gsl-lite repository from github and configure it as an external project.
cmake_minimum_required( VERSION 3.5 FATAL_ERROR )
project( use-gsl-lite LANGUAGES CXX )
# Set default ExternalProject root directory and add gsl-lite:
set( GSL_LITE_URL https://github.com/martinmoene/gsl-lite.git )
include( ExternalProject )
find_package( Git REQUIRED )
set_directory_properties( PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/3rd_party )
ExternalProject_Add(
gsl-extern
GIT_REPOSITORY ${GSL_LITE_URL}
TIMEOUT 10
UPDATE_COMMAND ${GIT_EXECUTABLE} pull
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
)
# Provide #include access to gsl-lite as 'gsl/gsl' and as 'gsl/gsl-lite.hpp':
ExternalProject_Get_Property( gsl-extern SOURCE_DIR )
set( GSL_LITE_INCLUDE_DIR ${SOURCE_DIR}/include CACHE INTERNAL "Include folder for gsl-lite")
add_library( gsl INTERFACE )
target_include_directories( gsl INTERFACE ${GSL_LITE_INCLUDE_DIR} )
# Build program from src:
add_subdirectory( src ) In folder src:
cmake_minimum_required( VERSION 3.5 FATAL_ERROR )
project( program-using-gsl-lite LANGUAGES CXX )
# Make program executable:
set( SOURCES main.cpp)
add_executable( program ${SOURCES} )
target_link_libraries( program PRIVATE gsl )This setup brings in more than you need, but also makes it easy to update gsl-lite to the latest version. See example/cmake-extern for a complete example.
First install the gsl-lite CMake package from its source, for example:
cd ./gsl-lite cmake -H. -B../_build -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX="~/dev" cmake --build ../_build --target install
See also script/install-gsl-pkg.py that can perform these steps for you. It also lets you control compiler and build configuration.
Next, you can use the gsl-lite CMake package, for example:
cmake_minimum_required( VERSION 3.5 FATAL_ERROR )
find_package( gsl-lite "0.33" REQUIRED )
project( program-using-gsl-lite LANGUAGES CXX )
add_executable( program main.cpp )
target_link_libraries( program PRIVATE gsl::gsl-lite )Configure and build:
cd ./gsl-lite/example/cmake-pkg cmake -H. -B../_build -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX=_stage -DCMAKE_PREFIX_PATH="~/dev" cmake --build ../_build
See example/cmake-pkg/Readme.md for a complete example.
For the conan package manager, follow these steps:
Add nonstd-lite to the conan remotes:
conan remote add nonstd-lite https://api.bintray.com/conan/martinmoene/nonstd-lite
Add a reference to gsl-lite to the requires section of your project's conanfile.txt file:
[requires] gsl-lite/0.34.0@nonstd-lite/stable
Run conan's install command:
conan install
Install it in the current environment:
conda install -c conda-forge gsl-lite
Install it in a different environment (named env_name in this example):
conda install -n env_name -c conda-forge gsl-lite
Create a new environment containing gsl-lite (and possibly other packages, appended at the end of the command):
conda create -n env_name -c conda-forge gsl-lite cmake
Add it to an already existing environment.yml file, and update the environment using:
conda env update
Contents
-Dgsl_api=""
Functions (methods) are decorated with gsl_api. At default gsl_api is defined empty for non-CUDA platforms and __host__ __device__ for the CUDA platform. Define this macro to specify your own function decoration.
-Dgsl_CPLUSPLUS=199711L
Define this macro to override the auto-detection of the supported C++ standard, if your compiler does not set the __cpluplus macro correctly.
-Dgsl_FEATURE_WITH_CONTAINER_TO_STD=99
Define this to the highest C++ standard (98, 3, 11, 14, 17, 20) you want to include tagged-construction via with_container. Default is 99 for inclusion with any standard.
-Dgsl_FEATURE_MAKE_SPAN_TO_STD=99
Define this to the highest C++ standard (98, 3, 11, 14, 17, 20) you want to include make_span() creator functions. Default is 99 for inclusion with any standard.
-Dgsl_FEATURE_BYTE_SPAN_TO_STD=99
Define this to the highest C++ standard (98, 3, 11, 14, 17, 20) you want to include byte_span() creator functions. Default is 99 for inclusion with any standard.
-Dgsl_FEATURE_IMPLICIT_MACRO=1
Define this macro to 0 to omit the implicit macro. Default is 1.
-Dgsl_FEATURE_OWNER_MACRO=1
At default macro Owner() is defined for all C++ versions. This may be useful to transition from a compiler that doesn't provide alias templates to one that does. Define this macro to 0 to omit the Owner() macro. Default is 1.
-Dgsl_FEATURE_EXPERIMENTAL_RETURN_GUARD=0
Provide experimental types final_action_return and final_action_error and convenience functions on_return() and on_error(). Default is 0.
gsl-lite provides contract violation response control as suggested in proposal N4415.
-Dgsl_CONFIG_CONTRACT_LEVEL_ON
Define this macro to include both Expects and Ensures in the code. This is the default case.
-Dgsl_CONFIG_CONTRACT_LEVEL_OFF
Define this macro to exclude both Expects and Ensures from the code.
-Dgsl_CONFIG_CONTRACT_LEVEL_EXPECTS_ONLY
Define this macro to include Expects in the code and exclude Ensures from the code.
-Dgsl_CONFIG_CONTRACT_LEVEL_ENSURES_ONLY
Define this macro to exclude Expects from the code and include Ensures in the code.
-Dgsl_CONFIG_CONTRACT_VIOLATION_TERMINATES
Define this macro to call std::terminate() on a GSL contract violation in Expects, Ensures and narrow. This is the default case.
-Dgsl_CONFIG_CONTRACT_VIOLATION_THROWS
Define this macro to throw a std::runtime_exception-derived exception gsl::fail_fast instead of calling std::terminate() on a GSL contract violation in Expects, Ensures and throw a std::exception-derived exception narrowing_error on discarding information in narrow.
-Dgsl_CONFIG_CONTRACT_VIOLATION_CALLS_HANDLER
Define this macro to call a user-defined handler function gsl::fail_fast_assert_handler() instead of calling std::terminate() on a GSL contract violation in Expects and Ensures, and call std::terminate() on discarding information in narrow. The user is expected to supply a definition matching the following signature:
namespace gsl {
gsl_api gsl_constexpr14 void fail_fast_assert_handler(
char const * const expression, char const * const message,
char const * const file, int line );
}-DGSL_UNENFORCED_ON_CONTRACT_VIOLATION
Equivalent to -Dgsl_CONFIG_CONTRACT_LEVEL_OFF.
-DGSL_THROW_ON_CONTRACT_VIOLATION
Equivalent to -Dgsl_CONFIG_CONTRACT_VIOLATION_THROWS.
-DGSL_TERMINATE_ON_CONTRACT_VIOLATION
Equivalent to -Dgsl_CONFIG_CONTRACT_VIOLATION_TERMINATES.
-Dgsl_CONFIG_DEPRECATE_TO_LEVEL=0
Define this to and including the level you want deprecation; see table Deprecation below. Default is 0 for no deprecation.
-Dgsl_CONFIG_SPAN_INDEX_TYPE=size_t
Define this macro to the type to use for indices in span and basic_string_span. Microsoft's GSL uses std::ptrdiff_t. Default for gsl lite is size_t.
-Dgsl_CONFIG_NOT_NULL_EXPLICIT_CTOR=0
Define this macro to 1 to make not_null's constructor explicit. Default is 0. Note that in Microsoft's GSL the constructor is explicit. For implicit construction you can also use the gsl lite-specific not_null-derived class not_null_ic.
-Dgsl_CONFIG_NOT_NULL_GET_BY_CONST_REF=0
Define this macro to 1 to have not_null<>::get() and relatives return by T const & instead of T. This may improve performance with types that have an expensive copy-constructor. Default is 0 for T.
-Dgsl_CONFIG_ALLOWS_NONSTRICT_SPAN_COMPARISON=1
Define this macro to 0 to omit the ability to compare spans of different types, e.g. of different const-volatile-ness. To be able to compare a string_span with a cstring_span, non-strict span comparison must be available. Default is 1.
-Dgsl_CONFIG_ALLOWS_UNCONSTRAINED_SPAN_CONTAINER_CTOR=0
Define this macro to 1 to add the unconstrained span constructor for containers for pre-C++11 compilers that cannot constrain the constructor. This constructor may prove too greedy and interfere with other constructors. Default is 0.
Note: an alternative is to use the constructor tagged with_container: span<value_type> s(with_container, cont).
-Dgsl_CONFIG_CONFIRMS_COMPILATION_ERRORS=0
Define this macro to 1 to experience the by-design compile-time errors of the GSL components in the test suite. Default is 0.
See also section GSL: Guidelines Support Library of the C++ Core Guidelines [9].
| Feature / library | GSL | M-GSL | GSL-Lite | Notes |
|---|---|---|---|---|
| 1.Lifetime safety | ||||
| 1.1 Indirection | ||||
| not_null<> | ✓ | ✓ | ✓ | Wrap any indirection and enforce non-null, see also Other configuration macros |
| not_null_ic<> | - | - | ✓ | not_null with implicit constructor, allowing copy-initialization |
| 1.2 Ownership | ||||
| owner<> | ✓ | ✓ | >=C++11 | Owned raw pointers |
| Owner() | - | - | ✓ | Macro for pre-C++11; see also Feature selection macros |
| unique_ptr<> | ✓ | ✓ | >=C++11 | std::unique_ptr<> |
| unique_ptr<> | - | - | < C++11 | VC10, VC11 |
| shared_ptr<> | ✓ | ✓ | >=C++11 | std::shared_ptr<> |
| shared_ptr<> | - | - | < C++11 | VC10, VC11 see also Extract Boost smart pointers |
| stack_array<> | ✓ | - | - | A stack-allocated array, fixed size |
| dyn_array<> | ? | - | - | A heap-allocated array, fixed size |
| 2.Bounds safety | ||||
| 2.1 Tag Types | ||||
| zstring | ✓ | ✓ | ✓ | a char* (C-style string) |
| wzstring | - | ✓ | ✓ | a wchar_t* (C-style string) |
| czstring | ✓ | ✓ | ✓ | a const char* (C-style string) |
| cwzstring | - | ✓ | ✓ | a const wchar_t* (C-style string) |
| 2.2 Views | ||||
| span<> | ✓ | ✓ | 1D views | A view of contiguous T's, replace (*,len), see also proposal p0122 |
| span_p<> | ✓ | - | - | A view of contiguous T's that ends at the first element for which predicate(*p) is true |
| make_span() | - | ✓ | ✓ | Create a span |
| byte_span() | - | - | ✓ | Create a span of bytes from a single object |
| as_bytes() | - | ✓ | ✓ | A span as bytes |
| as_writeable_bytes | - | ✓ | ✓ | A span as writeable bytes |
| basic_string_span<> | - | ✓ | ✓ | See also proposal p0123 |
| string_span | ✓ | ✓ | ✓ | basic_string_span<char> |
| wstring_span | - | ✓ | ✓ | basic_string_span<wchar_t > |
| cstring_span | ✓ | ✓ | ✓ | basic_string_span<const char> |
| cwstring_span | - | ✓ | ✓ | basic_string_span<const wchar_t > |
| ensure_z() | - | ✓ | ✓ | Create a cstring_span or cwstring_span |
| to_string() | - | ✓ | ✓ | Convert a string_span to std::string or std::wstring |
| 2.3 Indexing | ||||
| at() | ✓ | ✓ | >=C++11 | Bounds-checked way of accessing static arrays, std::array, std::vector |
| at() | - | - | < C++11 | static arrays, std::vector std::array : VC11 |
| 3. Assertions | ||||
| Expects() | ✓ | ✓ | ✓ | Precondition assertion |
| Ensures() | ✓ | ✓ | ✓ | Postcondition assertion |
| 4. Utilities | ||||
| index | ✓ | ✓ | ✓ | type for container indexes, subscripts, sizes, see Other configuration macros |
| byte | - | ✓ | ✓ | byte type, see also proposal p0298 |
| final_action<> | ✓ | ✓ | >=C++11 | Action at the end of a scope |
| final_action | - | - | < C++11 | Currently only void(*)() |
| finally() | ✓ | ✓ | >=C++11 | Make a final_action<> |
| finally() | - | - | < C++11 | Make a final_action |
| final_action_return | - | - | < C++11 | Currently only void(*)(), experimental |
| on_return() | - | - | >=C++11 | Make a final_action_return<>, experimental |
| on_return() | - | - | < C++11 | Make a final_action_return, experimental |
| final_action_error | - | - | < C++11 | Currently only void(*)(), experimental |
| on_error() | - | - | >=C++11 | Make a final_action_error<>, experimental |
| on_error() | - | - | < C++11 | Make a final_action_error, experimental |
| narrow_cast<> | ✓ | ✓ | ✓ | Searchable narrowing casts of values |
| narrow() | ✓ | ✓ | ✓ | Checked version of narrow_cast() |
| implicit | ✓ | - | ✓ | Symmetric with explicit |
| move_owner | ? | - | - | ... |
| 5. Algorithms | ||||
| copy() | Copy from source span to destination span | |||
| size() | Size of span, unsigned | |||
| ssize() | Size of span, signed | |||
| 6. Concepts | ||||
| ... |
Note: GSL Lite treats VC12 (VS2013) and VC14 (VS2015) as C++11 (gsl_CPP11_OR_GREATER: 1).
The following features are deprecated since the indicated version. See macro gsl_CONFIG_DEPRECATE_TO_LEVEL on how to control deprecation using the indicated level.
| Version | Level | Feature / Notes |
|---|---|---|
| 0.31.0 | 5 | span( std::nullptr_t, index_type ) |
| span( pointer, index_type ) is used | ||
| 0.31.0 | 5 | span( U *, index_type size ) |
| span( pointer, index_type ) is used | ||
| 0.31.0 | 5 | span( U (&arr)[N] ) |
| span( element_type (&arr)[N] ) is used | ||
| 0.31.0 | 5 | span( std::array< U, N > [const] & arr ) |
| span( std::array< value_type, N > [const] & arr ) is used | ||
| 0.29.0 | 4 | span::span( std::shared_ptr const & p ) |
| Use span( p.get(), p.get() ? 1 : 0 ) or equivalent | ||
| 0.29.0 | 4 | span::span( std::unique_ptr const & p ) |
| Use Use span( p.get(), p.get() ? 1 : 0 ) or equivalent | ||
| 0.29.0 | 3 | span::length() |
| Use span::size() | ||
| 0.29.0 | 3 | span::length_bytes() |
| Use span::size_bytes() | ||
| 0.17.0 | 2 | member span::as_bytes(), span::as_writeable_bytes() |
| — | ||
| 0.7.0 | 1 | gsl_CONFIG_ALLOWS_SPAN_CONTAINER_CTOR |
| Use gsl_CONFIG_ALLOWS_UNCONSTRAINED_SPAN_CONTAINER_CTOR, or consider span(with_container, cont). |
The table below mentions the compiler versions gsl-lite is reported to work with.
| OS | Compiler | Where | Versions |
|---|---|---|---|
| GNU/Linux | Clang/LLVM | Travis | 3.4, 3.4, 3.6, 3.7, 3.8, 3.9, 4.0, 5.0 |
| GCC | Travis | 5.4.1, 6.3.0, 7.2.0 | |
| OS X | ? | ? | |
| Windows | Clang/LLVM | ? | |
| GCC | Local | 4.8.4, 4.9.2, 5.2.0, 7.2.0 | |
| Visual C++ (Visual Studio) |
Local Local AppVeyor |
6 (6) via header gsl-lite-vc6.hpp (not up to date) 8 (2005), 10 (2010), 11 (2012), 12 (2013), 14 (2015), 15 (2017) |
|
| DOSBox | DJGPP | Local | DJGPP for GCC 7.2.0 |
| FreeDOS | DJGPP | Local | DJGPP for GCC 7.2.0 |
To build the tests you need:
The lest test framework is included in the test folder.
The following steps assume that the GSL Lite source code has been cloned into a directory named c:\gsl-lite.
Create a directory for the build outputs for a particular architecture.
Here we use c:\gsl-lite\build-win-x86-vc10.
cd c:\gsl-lite md build-win-x86-vc10 cd build-win-x86-vc10
Configure CMake to use the compiler of your choice (run cmake --help for a list).
cmake -G "Visual Studio 10 2010" ..
Build the test suite in the Debug configuration (alternatively use Release).
cmake --build . --config Debug
Run the test suite.
ctest -V -C Debug
All tests should pass, indicating your platform is supported and you are ready to use gsl-lite. See the table with supported types and functions.
[1] span on cppreference.
[2] span in C++20 Working Draft.
[3] p0091 - Template argument deduction for class templates.
[4] p0122 - span: bounds-safe views for sequences of objects.
[5] p0123 - string_span: bounds-safe views for sequences of characters .
[6] p0298 - A byte type definition.
[7] p0805 - Comparing Containers.
[8] Standard C++ Foundation.
[9] Standard C++ Foundation. C++ Core Guidelines.
[10] Microsoft. Guidelines Support Library (GSL).
[11] Bjarne Stroustrup. Writing good C++14 (PDF) — Video. CppCon 2015.
[12] Herb Sutter. Writing good C++14… By default (PDF) — Video. CppCon 2015.
[13] Gabriel Dos Reis. Contracts for Dependable C++ (PDF) — Video. CppCon 2015.
[14] Bjarne Stroustrup et al. A brief introduction to C++’s model for type- and resource-safety.
[15] Herb Sutter and Neil MacIntosh. Lifetime Safety: Preventing Leaks and Dangling. 21 Sep 2015.
[16] cppreference.com. Feature Test Recommendations.
[17] cppreference.com. Feature testing macros.
[18] Visual CPP Team. C++0x Core Language Features In VC10: The Table. Microsoft. 6 April 2010.
[19] Visual CPP Team. C++11 Features in Visual C++ 11. Microsoft. 12 September 2011.
[20] Joel Coehoorn. C++11 features in Visual Studio 2012. StackOverflow. 14 September 2011.
[21] Stephan T. Lavavej. C++11/14 Features In Visual Studio 14 CTP3. Microsoft. 21 August 2014.
[22] Stephan T. Lavavej. C++11/14/17 Features In VS 2015 RTM. Microsoft. 19 June 2015.
Contents
To obtain a subset of Boost only containing the smart pointers, use the bcp command like:
C:\Libraries\boost\boost_1_51>bin\bcp scoped_ptr.hpp shared_ptr.hpp weak_ptr.hpp make_shared.hpp C:\Libraries\boost-shared_ptr
The smart pointers of Boost 1.51 can be used with VC6.
The version of gsl lite is available via tag [.version]. The following tags are available for information on the compiler and on the C++ standard library used: [.compiler], [.stdc++], [.stdlanguage] and [.stdlibrary].
Expects(): Allows a true expression Ensures(): Allows a true expression Expects(): Terminates on a false expression Ensures(): Terminates on a false expression at(): Terminates access to non-existing C-array elements at(): Terminates access to non-existing std::array elements (C++11) at(): Terminates access to non-existing std::vector elements at(): Terminates access to non-existing std::initializer_list elements (C++11) at(): Terminates access to non-existing gsl::span elements at(): Allows to access existing C-array elements at(): Allows to access existing std::array elements (C++11) at(): Allows to access existing std::vector elements at(): Allows to access std::initializer_list elements (C++11) at(): Allows to access gsl::span elements byte: Allows to construct from integral via static cast (C++17) byte: Allows to construct from integral via byte() (C++17) byte: Allows to construct from integral via to_byte() byte: Allows to convert to integral via to_integer() byte: Allows comparison operations byte: Allows bitwise or operation byte: Allows bitwise and operation byte: Allows bitwise x-or operation byte: Allows bitwise or assignment byte: Allows bitwise and assignment byte: Allows bitwise x-or assignment byte: Allows shift-left operation byte: Allows shift-right operation byte: Allows shift-left assignment byte: Allows shift-right assignment byte: Provides constexpr non-assignment operations (C++11) byte: Provides constexpr assignment operations (C++14) byte: Provides hash support (C++11) not_null<>: Disallows default construction (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS) not_null<>: Disallows construction from nullptr_t, NULL or 0 (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS) not_null<>: Disallows construction from a unique pointer to underlying type (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS) not_null<>: Disallows assignment from unrelated pointers (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS) not_null<>: Terminates construction from a null pointer value not_null<>: Terminates construction from related pointer types for null pointer value not_null<>: Terminates assignment from a null pointer value not_null<>: Terminates assignment from related pointer types for null pointer value not_null<>: Allows to construct from a non-null underlying pointer not_null<>: Allows to construct from a non-null user-defined ref-counted type not_null<>: Allows to construct from a non-null related pointer not_null<>: Allows to construct from a not_null related pointer type not_null<>: Allows assignment from a not_null related pointer type not_null<>: Allows assignment from a non-null bare recast pointer not_null<>: Allows implicit conversion to underlying type not_null<>: Allows indirect member access not_null<>: Allows dereferencing not_null<>: Allows to compare equal to another not_null of the same type not_null<>: Allows to compare unequal to another not_null of the same type not_null<>: Allows to compare less than another not_null of the same type not_null<>: Allows to compare less than or equal to another not_null of the same type not_null<>: Allows to compare greater than another not_null of the same type not_null<>: Allows to compare greater than or equal to another not_null of the same type not_null<>: Allows to compare equal to a raw pointer of the same type not_null<>: Allows to compare unequal to a raw pointer of the same type not_null<>: Allows to compare less than a raw pointer of the same type not_null<>: Allows to compare less than or equal to a raw pointer of the same type not_null<>: Allows to compare greater than a raw pointer of the same type not_null<>: Allows to compare greater than or equal to a raw pointer of the same type owner<>: Disallows construction from a non-pointer type (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS) owner<>: Allows its use as the (pointer) type it stands for Owner(): Allows its use as the (pointer) type it stands for span<>: Disallows construction from a temporary value (C++11) (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS) span<>: Disallows construction from a C-array of incompatible type (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS) span<>: Disallows construction from a std::array of incompatible type (C++11) (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS) span<>: Terminates construction from a nullptr and a non-zero size (C++11) span<>: Terminates construction from two pointers in the wrong order span<>: Terminates construction from a null pointer and a non-zero size span<>: Terminates creation of a sub span of the first n elements for n exceeding the span span<>: Terminates creation of a sub span of the last n elements for n exceeding the span span<>: Terminates creation of a sub span outside the span span<>: Terminates access outside the span span<>: Allows to default-construct span<>: Allows to construct from a nullptr and a zero size (C++11) span<>: Allows to construct from a single object (C++11) span<>: Allows to construct from a const single object (C++11) span<>: Allows to construct from two pointers span<>: Allows to construct from two pointers to const span<>: Allows to construct from a non-null pointer and a size span<>: Allows to construct from a non-null pointer to const and a size span<>: Allows to construct from a temporary pointer and a size span<>: Allows to construct from a temporary pointer to const and a size span<>: Allows to construct from any pointer and a zero size span<>: Allows to construct from a C-array span<>: Allows to construct from a const C-array span<>: Allows to construct from a C-array with size via decay to pointer (potentially dangerous) span<>: Allows to construct from a const C-array with size via decay to pointer (potentially dangerous) span<>: Allows to construct from a std::array<> (C++11) span<>: Allows to construct from a std::array<> with const data (C++11) [deprecated-5] span<>: Allows to construct from a container (std::vector<>) span<>: Allows to construct from a temporary container (potentially dangerous) span<>: Allows to tag-construct from a container (std::vector<>) span<>: Allows to tag-construct from a temporary container (potentially dangerous) span<>: Allows to construct from an empty gsl::shared_ptr (C++11) [deprecated-4] span<>: Allows to construct from an empty gsl::unique_ptr (C++11) [deprecated-4] span<>: Allows to construct from an empty gsl::unique_ptr (array, C++11) [deprecated-4] span<>: Allows to construct from a non-empty gsl::shared_ptr (C++11) [deprecated-4] span<>: Allows to construct from a non-empty gsl::unique_ptr (C++11) [deprecated-4] span<>: Allows to construct from a non-empty gsl::unique_ptr (array, C++11) [deprecated-4] span<>: Allows to copy-construct from another span of the same type span<>: Allows to copy-construct from another span of a compatible type span<>: Allows to move-construct from another span of the same type (C++11) span<>: Allows to copy-assign from another span of the same type span<>: Allows to move-assign from another span of the same type (C++11) span<>: Allows to create a sub span of the first n elements span<>: Allows to create a sub span of the last n elements span<>: Allows to create a sub span starting at a given offset span<>: Allows to create a sub span starting at a given offset with a given length span<>: Allows to create an empty sub span at full offset span<>: Allows to create an empty sub span at full offset with zero length span<>: Allows forward iteration span<>: Allows const forward iteration span<>: Allows reverse iteration span<>: Allows const reverse iteration span<>: Allows to observe an element via array indexing span<>: Allows to observe an element via call indexing span<>: Allows to observe an element via at() span<>: Allows to observe an element via data() span<>: Allows to change an element via array indexing span<>: Allows to change an element via call indexing span<>: Allows to change an element via at() span<>: Allows to change an element via data() span<>: Allows to compare equal to another span of the same type span<>: Allows to compare unequal to another span of the same type span<>: Allows to compare less than another span of the same type span<>: Allows to compare less than or equal to another span of the same type span<>: Allows to compare greater than another span of the same type span<>: Allows to compare greater than or equal to another span of the same type span<>: Allows to compare to another span of the same type and different cv-ness (non-standard) span<>: Allows to compare empty spans as equal span<>: Allows to test for empty span via empty(), empty case span<>: Allows to test for empty span via empty(), non-empty case span<>: Allows to obtain the number of elements via size(), as configured span<>: Allows to obtain the number of elements via ssize(), signed span<>: Allows to obtain the number of elements via length() [deprecated-3] span<>: Allows to obtain the number of bytes via size_bytes() span<>: Allows to obtain the number of bytes via length_bytes() [deprecated-3] span<>: Allows to swap with another span of the same type span<>: Allows to view the elements as read-only bytes [deprecated-2 as member] span<>: Allows to view and change the elements as writable bytes [deprecated-2 as member] span<>: Allows to view the elements as a span of another type span<>: Allows to change the elements from a span of another type copy(): Allows to copy a span to another span of the same element type copy(): Allows to copy a span to another span of a different element type size(): Allows to obtain the number of elements in span via size(span), unsigned ssize(): Allows to obtain the number of elements in span via ssize(span), signed make_span(): (gsl_FEATURE_MAKE_SPAN=1) make_span(): Allows to build from two pointers make_span(): Allows to build from two const pointers make_span(): Allows to build from a non-null pointer and a size make_span(): Allows to build from a non-null const pointer and a size make_span(): Allows to build from a C-array make_span(): Allows to build from a const C-array make_span(): Allows to build from a std::array<> (C++11) make_span(): Allows to build from a const std::array<> (C++11) make_span(): Allows to build from a container (std::vector<>) make_span(): Allows to build from a const container (std::vector<>) make_span(): Allows to build from a temporary container (potentially dangerous) make_span(): Allows to tag-build from a container (std::vector<>) make_span(): Allows to tag-build from a temporary container (potentially dangerous) make_span(): Allows to build from an empty gsl::shared_ptr (C++11) [deprecated-4] make_span(): Allows to build from an empty gsl::unique_ptr (C++11) [deprecated-4] make_span(): Allows to build from an empty gsl::unique_ptr (array, C++11) [deprecated-4] make_span(): Allows to build from a non-empty gsl::shared_ptr (C++11) [deprecated-4] make_span(): Allows to build from a non-empty gsl::unique_ptr (C++11) [deprecated-4] make_span(): Allows to build from a non-empty gsl::unique_ptr (array, C++11) [deprecated-4] byte_span() (gsl_FEATURE_BYTE_SPAN=1) byte_span(): Allows to build a span of gsl::byte from a single object byte_span(): Allows to build a span of const gsl::byte from a single const object string_span: Disallows construction of a string_span from a cstring_span (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS) string_span: Disallows construction of a string_span from a const std::string (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS) string_span: Allows to default-construct string_span: Allows to construct from a nullptr (C++11) string_span: Allows to construct a cstring_span from a const C-string string_span: Allows to construct a string_span from a non-const C-string and size string_span: Allows to construct a string_span from a non-const C-string begin and end pointer string_span: Allows to construct a string_span from a non-const C-array string_span: Allows to construct a string_span from a non-const std::string string_span: Allows to construct a string_span from a non-const std::array (C++11) string_span: Allows to construct a string_span from a non-const container (std::vector) string_span: Allows to construct a string_span from a non-const container, via a tag (std::vector) string_span: Allows to construct a cstring_span from a non-const C-string and size string_span: Allows to construct a cstring_span from a non-const C-string begin and end pointer string_span: Allows to construct a cstring_span from a non-const C-array string_span: Allows to construct a cstring_span from a non-const std::string string_span: Allows to construct a cstring_span from a non-const std::array (C++11) string_span: Allows to construct a cstring_span from a non-const container (std::vector) string_span: Allows to construct a cstring_span from a non-const container, via a tag (std::vector) string_span: Allows to construct a cstring_span from a const C-string and size string_span: Allows to construct a cstring_span from a non-const C-string begin and end pointer string_span: Allows to construct a cstring_span from a const C-array string_span: Allows to construct a cstring_span from a const std::string string_span: Allows to construct a cstring_span from a const std::array (C++11) string_span: Allows to construct a cstring_span from a const container (std::vector) string_span: Allows to construct a cstring_span from a const container, via a tag (std::vector) string_span: Allows to construct a wstring_span from a non-const C-string and size string_span: Allows to construct a wstring_span from a non-const C-string begin and end pointer string_span: Allows to construct a wstring_span from a non-const C-array string_span: Allows to construct a wstring_span from a non-const std::wstring string_span: Allows to construct a wstring_span from a non-const std::array (C++11) string_span: Allows to construct a wstring_span from a non-const container (std::vector) string_span: Allows to construct a wstring_span from a non-const container, via a tag (std::vector) string_span: Allows to construct a cwstring_span from a non-const C-string and size string_span: Allows to construct a cwstring_span from a non-const C-string begin and end pointer string_span: Allows to construct a cwstring_span from a non-const C-array string_span: Allows to construct a cwstring_span from a non-const std::wstring string_span: Allows to construct a cwstring_span from a non-const std::array (C++11) string_span: Allows to construct a cwstring_span from a non-const container (std::vector) string_span: Allows to construct a cwstring_span from a non-const container, via a tag (std::vector) string_span: Allows to construct a cwstring_span from a const C-string and size string_span: Allows to construct a cwstring_span from a const C-string begin and end pointer string_span: Allows to construct a cwstring_span from a const C-array string_span: Allows to construct a cwstring_span from a const std::wstring string_span: Allows to construct a cwstring_span from a const std::array (C++11) string_span: Allows to construct a cwstring_span from a const container (std::vector) string_span: Allows to construct a cwstring_span from a const container, via a tag (std::vector) string_span: Allows to copy-construct from another span of the same type string_span: Allows to copy-construct from another span of a compatible type string_span: Allows to move-construct from another span of the same type (C++11) string_span: Allows to copy-assign from another span of the same type string_span: Allows to move-assign from another span of the same type (C++11) string_span: Allows to create a sub span of the first n elements string_span: Allows to create a sub span of the last n elements string_span: Allows to create a sub span starting at a given offset string_span: Allows to create a sub span starting at a given offset with a given length string_span: Allows to create an empty sub span at full offset string_span: Allows to create an empty sub span at full offset with zero length string_span: Allows forward iteration string_span: Allows const forward iteration string_span: Allows reverse iteration string_span: Allows const reverse iteration string_span: Allows to observe an element via array indexing string_span: Allows to observe an element via call indexing string_span: Allows to observe an element via data() string_span: Allows to change an element via array indexing string_span: Allows to change an element via call indexing string_span: Allows to change an element via data() string_span: Allows to compare a string_span with another string_span string_span: Allows to compare empty span to non-empty span string_span: Allows to compare a string_span with a cstring_span string_span: Allows to compare with types convertible to string_span string_span: Allows to test for empty span via empty(), empty case string_span: Allows to test for empty span via empty(), non-empty case string_span: Allows to obtain the number of elements via length() string_span: Allows to obtain the number of elements via size() string_span: Allows to obtain the number of bytes via length_bytes() string_span: Allows to obtain the number of bytes via size_bytes() string_span: Allows to view the elements as read-only bytes to_string(): Allows to explicitly convert from string_span to std::string to_string(): Allows to explicitly convert from cstring_span to std::string to_string(): Allows to explicitly convert from wstring_span to std::wstring to_string(): Allows to explicitly convert from cwstring_span to std::wstring ensure_z(): Disallows to build a string_span from a const C-string ensure_z(): Disallows to build a wstring_span from a const wide C-string ensure_z(): Allows to build a string_span from a non-const C-string ensure_z(): Allows to build a cstring_span from a non-const C-string ensure_z(): Allows to build a cstring_span from a const C-string ensure_z(): Allows to build a wstring_span from a non-const wide C-string ensure_z(): Allows to build a cwstring_span from a non-const wide C-string ensure_z(): Allows to build a cwstring_span from a const wide C-string ensure_z(): Allows to specify ultimate location of the sentinel and ensure its presence operator<<: Allows printing a string_span to an output stream operator<<: Allows printing a cstring_span to an output stream operator<<: Allows printing a wstring_span to an output stream operator<<: Allows printing a cwstring_span to an output stream finally: Allows to run lambda on leaving scope finally: Allows to run function (bind) on leaving scope finally: Allows to run function (pointer) on leaving scope finally: Allows to move final_action on_return: Allows to perform action on leaving scope without exception (gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD) on_error: Allows to perform action on leaving scope via an exception (gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD) narrow_cast<>: Allows narrowing without value loss narrow_cast<>: Allows narrowing with value loss narrow<>(): Allows narrowing without value loss narrow<>(): Terminates when narrowing with value loss narrow<>(): Terminates when narrowing with sign loss
| Back | FazBrowse Home | New Git URL |