• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

README.mdH A D08-Nov-202147.9 KiB862693

gslH A D08-Nov-2021940 2822

gsl-lite-vc6.hppH A D08-Nov-202114.8 KiB698477

gsl-lite.hH A D08-Nov-20211 KiB306

gsl-lite.hppH A D08-Nov-202178.7 KiB2,8882,107

README.md

1# GSL Lite: Guidelines Support Library for C++98, C++11 up
2
3[![Language](https://img.shields.io/badge/C%2B%2B-98/11/14/17-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Build Status](https://travis-ci.org/martinmoene/gsl-lite.svg?branch=master)](https://travis-ci.org/martinmoene/gsl-lite) [![Build status](https://ci.appveyor.com/api/projects/status/1ha3wnxtam547m8p?svg=true)](https://ci.appveyor.com/project/martinmoene/gsl-lite) [![Version](https://badge.fury.io/gh/martinmoene%2Fgsl-lite.svg)](https://github.com/martinmoene/gsl-lite/releases) [![download](https://img.shields.io/badge/latest-download-blue.svg)](https://raw.githubusercontent.com/martinmoene/gsl-lite/master/include/gsl/gsl-lite.hpp) [![Conan](https://img.shields.io/badge/on-conan-blue.svg)](https://bintray.com/martinmoene/nonstd-lite/gsl-lite%3Anonstd-lite/_latestVersion) [![Try it on wandbox](https://img.shields.io/badge/on-wandbox-blue.svg)](https://wandbox.org/permlink/fKCm0ERwPgFTH72I) [![Try it on godbolt online](https://img.shields.io/badge/on-godbolt-blue.svg)](https://godbolt.org/g/iEAxnY)
4
5
6GSL Lite is based on the [Microsoft Guidelines Support Library (GSL)](https://github.com/microsoft/gsl).
7
8**Contents**
9- [Example usage](#example-usage)
10- [In a nutshell](#in-a-nutshell)
11- [License](#license)
12- [Dependencies](#dependencies)
13- [Installation and use](#installation-and-use)
14- [Synopsis](#synopsis)
15- [Features](#features)
16- [Deprecation](#deprecation)
17- [Reported to work with](#reported-to-work-with)
18- [Building the tests](#building-the-tests)
19- [Other GSL implementations](#other-gsl-implementations)
20- [Notes and references](#notes-and-references)
21- [Appendix](#appendix)
22
23
24Example usage
25-------------
26
27```Cpp
28#include "gsl/gsl-lite.hpp"
29
30using namespace gsl;
31
32int * use( not_null<int *> p )
33{
34    // use p knowing it's not nullptr, NULL or 0.
35
36    return p;
37}
38
39struct Widget
40{
41    Widget() : owned_ptr( new int(42) ) {}
42    ~Widget() { delete owned_ptr; }
43
44    void work() { non_owned_ptr = use( owned_ptr ); }
45
46    owner<int *> owned_ptr;	// if alias template support
47//  Owner(int *) owned_ptr;	// C++98 up
48    int * non_owned_ptr;
49};
50
51int main()
52{
53    Widget w;
54    w.work();
55}
56```
57
58### Compile and run
59
60```
61prompt>g++ -std=c++03 -Wall -I../include -o 01-basic.exe 01-basic.cpp && 01-basic.exe
62```
63
64In a nutshell
65-------------
66**gsl-lite** is a single-file header-only variant of Microsoft's implementation of the [Guidelines Support Library (GSL)](https://github.com/Microsoft/GSL) adapted for C++98, C++03. It should also work when compiled as C++11, C++14, C++17.
67
68The Guidelines Support Library (GSL) contains functions and types that are suggested for use by the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines) maintained by the [Standard C++ Foundation](https://isocpp.org/). The library includes types like `owner<>`, `not_null<>`, `span<>`, `string_span` and [others](#features).
69
70*gsl-lite* recognizes when it is compiled for the CUDA platform and decorates functions (methods) with `__host__` and `__device__`. See also section [API macro](#api-macro).
71
72
73License
74-------
75*gsl-lite* uses the [MIT](LICENSE) license.
76
77
78Dependencies
79------------
80*gsl-lite* has no other dependencies than the [C++ standard library](http://en.cppreference.com/w/cpp/header).
81
82
83Installation and use
84--------------------
85*gsl-lite* is a single-file header-only library. There are various ways to use it in your project.
86
87**Contents**
88- [As copied header](#as-copied-header)
89- [As external Git project](#as-external-git-project)
90- [As CMake package](#as-cmake-package)
91- [As Conan package](#as-conan-package)
92- [As Conda package](#as-conda-package)
93
94### As copied header
95
96Put a copy of [`gsl-lite.hpp`](include/gsl/gsl-lite.hpp) located in folder [include/gsl](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`](include/gsl/gsl). A minimal CMake setup using this header might look as follows.
97
98In project root folder:
99
100```CMake
101cmake_minimum_required( VERSION 3.5 FATAL_ERROR )
102
103project( use-gsl-lite LANGUAGES CXX )
104
105# Provide #include access to gsl-lite as 'gsl/gsl' and as 'gsl/gsl-lite.hpp':
106
107set( GSL_LITE_INCLUDE_DIR include )  # adapt as necessary
108add_library( gsl INTERFACE )
109target_include_directories( gsl INTERFACE ${GSL_LITE_INCLUDE_DIR} )
110
111# Build program from src:
112
113add_subdirectory( src )
114```
115
116In folder src:
117
118```CMake
119cmake_minimum_required( VERSION 3.5 FATAL_ERROR )
120
121project( program-using-gsl-lite LANGUAGES CXX )
122
123# Make program executable:
124
125set( SOURCES main.cpp)
126add_executable( program ${SOURCES} )
127target_link_libraries( program PRIVATE gsl )
128```
129
130### As external Git project
131
132Another approach is to automatically fetch the entire *gsl-lite* repository from github and configure it as an external project.
133
134```CMake
135cmake_minimum_required( VERSION 3.5 FATAL_ERROR )
136
137project( use-gsl-lite LANGUAGES CXX )
138
139# Set default ExternalProject root directory and add gsl-lite:
140
141set( GSL_LITE_URL https://github.com/martinmoene/gsl-lite.git )
142
143include( ExternalProject )
144find_package( Git REQUIRED )
145
146set_directory_properties( PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/3rd_party )
147
148ExternalProject_Add(
149    gsl-extern
150    GIT_REPOSITORY ${GSL_LITE_URL}
151    TIMEOUT 10
152    UPDATE_COMMAND ${GIT_EXECUTABLE} pull
153    CONFIGURE_COMMAND ""
154    BUILD_COMMAND ""
155    INSTALL_COMMAND ""
156    LOG_DOWNLOAD ON
157   )
158
159# Provide #include access to gsl-lite as 'gsl/gsl' and as 'gsl/gsl-lite.hpp':
160
161ExternalProject_Get_Property( gsl-extern SOURCE_DIR )
162set( GSL_LITE_INCLUDE_DIR ${SOURCE_DIR}/include CACHE INTERNAL "Include folder for gsl-lite")
163
164add_library( gsl INTERFACE )
165target_include_directories( gsl INTERFACE ${GSL_LITE_INCLUDE_DIR} )
166
167# Build program from src:
168
169add_subdirectory( src )
170```
171
172In folder src:
173```CMake
174cmake_minimum_required( VERSION 3.5 FATAL_ERROR )
175
176project( program-using-gsl-lite LANGUAGES CXX )
177
178# Make program executable:
179
180set( SOURCES main.cpp)
181add_executable( program ${SOURCES} )
182target_link_libraries( program PRIVATE gsl )
183```
184
185This setup brings in more than you need, but also makes it easy to update *gsl-lite* to the latest version.  See [example/cmake-extern](example/cmake-extern) for a complete example.
186
187
188### As CMake package
189
1901. First install the *gsl-lite* CMake package from its source, for example:
191
192		cd ./gsl-lite
193		cmake -H. -B../_build -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX="~/dev"
194		cmake --build ../_build --target install
195
196	See also [script/install-gsl-pkg.py](script/install-gsl-pkg.py) that can perform these steps for you. It also lets you control compiler and build configuration.
197
1982. Next, you can use the *gsl-lite* CMake package, for example:
199
200	```CMake
201	cmake_minimum_required( VERSION 3.5 FATAL_ERROR )
202
203	find_package( gsl-lite "0.33" REQUIRED )
204
205	project( program-using-gsl-lite LANGUAGES CXX )
206
207	add_executable(        program main.cpp )
208	target_link_libraries( program PRIVATE gsl::gsl-lite )
209	```
210	Configure and build:
211
212		cd ./gsl-lite/example/cmake-pkg
213		cmake -H. -B../_build -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX=_stage -DCMAKE_PREFIX_PATH="~/dev"
214		cmake --build ../_build
215
216	See [example/cmake-pkg/Readme.md](example/cmake-pkg/Readme.md) for a complete example.
217
218### As Conan package
219
220For the [conan package manager](https://www.conan.io/), follow these steps:
221
2221. Add *nonstd-lite* to the conan remotes:
223
224        conan remote add nonstd-lite https://api.bintray.com/conan/martinmoene/nonstd-lite
225
2262. Add a reference to *gsl-lite* to the *requires* section of your project's `conanfile.txt` file:
227
228        [requires]
229        gsl-lite/0.34.0@nonstd-lite/stable
230
2313. Run conan's install command:
232
233        conan install
234
235### As Conda package
236
2371. For the [conda package manager](https://conda.io), first use **one of these options** to install `gsl-lite` from the [`conda-forge`](https://conda-forge.org/) channel:
238
239 * Install it in the current environment:
240
241        conda install -c conda-forge gsl-lite
242
243 * Install it in a different environment (named `env_name` in this example):
244
245        conda install -n env_name -c conda-forge gsl-lite
246
247 * Create a new environment containing *gsl-lite* (and possibly other packages, appended at the end of the command):
248
249        conda create -n env_name -c conda-forge gsl-lite cmake
250
251 * Add it to an already existing [`environment.yml`](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-from-an-environment-yml-file) file, and update the environment using:
252
253        conda env update
254
2552. Then activate the environment using `conda activate env_name` (if not already activated) and proceed using the instructions from step 2 of ["As CMake package"](#as-cmake-package). Note that it's also useful to have the `cmake` package in the same environment, and explicitly passing `-DCMAKE_INSTALL_PREFIX` is not necessary.
256
257
258Synopsis
259--------
260
261**Contents**
262- [API macro](#api-macro)
263- [Standard selection macro](#standard-selection-macro)
264- [Feature selection macros](#feature-selection-macros)
265- [Contract violation response macros](#contract-violation-response-macros)
266- [Microsoft GSL compatibility macros](#microsoft-gsl-compatibility-macros)
267- [Other configuration macros](#other-configuration-macros)
268
269### API macro
270
271\-D<b>gsl\_api</b>=""
272Functions (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.
273
274### Standard selection macro
275
276\-D<b>gsl\_CPLUSPLUS</b>=199711L
277Define this macro to override the auto-detection of the supported C++ standard, if your compiler does not set the `__cpluplus` macro correctly.
278
279### Feature selection macros
280
281\-D<b>gsl\_FEATURE\_WITH\_CONTAINER\_TO\_STD</b>=99
282Define 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.
283
284\-D<b>gsl\_FEATURE\_MAKE\_SPAN\_TO\_STD</b>=99
285Define 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.
286
287\-D<b>gsl\_FEATURE\_BYTE\_SPAN\_TO\_STD</b>=99
288Define 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.
289
290\-D<b>gsl\_FEATURE\_IMPLICIT\_MACRO</b>=1
291Define this macro to 0 to omit the `implicit` macro. Default is 1.
292
293\-D<b>gsl\_FEATURE\_OWNER\_MACRO</b>=1
294At 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.
295
296\-D<b>gsl\_FEATURE\_EXPERIMENTAL\_RETURN\_GUARD</b>=0
297Provide experimental types `final_action_return` and `final_action_error` and convenience functions `on_return()` and `on_error()`. Default is 0.
298
299### Contract violation response macros
300
301*gsl-lite* provides contract violation response control as suggested in proposal [N4415](http://wg21.link/n4415).
302
303\-D<b>gsl\_CONFIG\_CONTRACT\_LEVEL\_ON</b>
304Define this macro to include both `Expects` and `Ensures` in the code. This is the default case.
305
306\-D<b>gsl\_CONFIG\_CONTRACT\_LEVEL\_OFF</b>
307Define this macro to exclude both `Expects` and `Ensures` from the code.
308
309\-D<b>gsl\_CONFIG_CONTRACT\_LEVEL\_EXPECTS\_ONLY</b>
310Define this macro to include `Expects` in the code and exclude `Ensures` from the code.
311
312\-D<b>gsl\_CONFIG\_CONTRACT\_LEVEL\_ENSURES\_ONLY</b>
313Define this macro to exclude `Expects` from the code and include `Ensures` in the code.
314
315\-D<b>gsl\_CONFIG\_CONTRACT\_VIOLATION\_TERMINATES</b>
316Define this macro to call `std::terminate()` on a GSL contract violation in `Expects`, `Ensures` and `narrow`. This is the default case.
317
318\-D<b>gsl\_CONFIG\_CONTRACT\_VIOLATION\_THROWS</b>
319Define 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`.
320
321\-D<b>gsl\_CONFIG\_CONTRACT\_VIOLATION\_CALLS\_HANDLER</b>
322Define 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:
323
324```Cpp
325namespace gsl {
326	gsl_api gsl_constexpr14 void fail_fast_assert_handler(
327		char const * const expression, char const * const message,
328		char const * const file, int line );
329}
330```
331
332### Microsoft GSL compatibility macros
333
334\-D<b>GSL_UNENFORCED_ON_CONTRACT_VIOLATION</b>
335Equivalent to -Dgsl_CONFIG_CONTRACT_LEVEL_OFF.
336
337\-D<b>GSL\_THROW\_ON\_CONTRACT\_VIOLATION</b>
338Equivalent to -Dgsl\_CONFIG\_CONTRACT\_VIOLATION\_THROWS.
339
340\-D<b>GSL\_TERMINATE\_ON\_CONTRACT\_VIOLATION</b>
341Equivalent to -Dgsl\_CONFIG\_CONTRACT\_VIOLATION\_TERMINATES.
342
343### Other configuration macros
344
345\-D<b>gsl\_CONFIG\_DEPRECATE\_TO\_LEVEL</b>=0
346Define this to and including the level you want deprecation; see table [Deprecation](#deprecation) below. Default is 0 for no deprecation.
347
348\-D<b>gsl\_CONFIG\_SPAN\_INDEX\_TYPE</b>=size_t
349Define 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`.
350
351\-D<b>gsl\_CONFIG\_NOT\_NULL\_EXPLICIT\_CTOR</b>=0
352Define 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`.
353
354\-D<b>gsl\_CONFIG\_NOT\_NULL\_GET_BY\_CONST\_REF</b>=0
355Define 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`.
356
357\-D<b>gsl\_CONFIG\_ALLOWS\_NONSTRICT\_SPAN\_COMPARISON</b>=1
358Define 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.
359
360\-D<b>gsl\_CONFIG\_ALLOWS\_UNCONSTRAINED\_SPAN\_CONTAINER\_CTOR</b>=0
361Define 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.
362
363Note: an alternative is to use the constructor tagged `with_container`: span&lt;_value_type_> *s*(with_container, *cont*).
364
365\-D<b>gsl\_CONFIG\_CONFIRMS\_COMPILATION\_ERRORS</b>=0
366Define this macro to 1 to experience the by-design compile-time errors of the GSL components in the test suite. Default is 0.
367
368
369Features
370--------
371See also section [GSL: Guidelines Support Library](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#S-gsl) of the C++ Core Guidelines [9].
372
373Feature / library           | GSL     | M-GSL   | GSL-Lite| Notes |
374----------------------------|:-------:|:-------:|:-------:|:------|
375**1.Lifetime&nbsp;safety**  | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
376**1.1 Indirection**         | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
377not_null<>                  | &#10003;| &#10003;| &#10003;| Wrap any indirection and enforce non-null,<br>see also [Other configuration macros](#other-configuration-macros) |
378not_null_ic<>               | -       | -       | &#10003;| not_null with implicit constructor, allowing [copy-initialization](https://en.cppreference.com/w/cpp/language/copy_initialization) |
379**1.2 Ownership**           | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
380owner<>                     | &#10003;| &#10003;| >=C++11 | Owned raw pointers |
381Owner()                     | -       | -       | &#10003;| Macro for pre-C++11;<br>see also [Feature selection macros](#feature-selection-macros) |
382unique_ptr<>                | &#10003;| &#10003;| >=C++11 | std::unique_ptr<> |
383unique_ptr<>                | -       | -       | < C++11 | VC10, VC11 |
384shared_ptr<>                | &#10003;| &#10003;| >=C++11 | std::shared_ptr<> |
385shared_ptr<>                | -       | -       | < C++11 | VC10, VC11<br>see also [Extract Boost smart pointers](#a1-extract-boost-smart-pointers) |
386stack_array<>               | &#10003;| -       | -       | A stack-allocated array, fixed size |
387dyn_array<>                 | ?       | -       | -       | A heap-allocated array, fixed size |
388**2.Bounds&nbsp;safety**    | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
389**2.1 Tag Types**           | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
390zstring                     | &#10003;| &#10003;| &#10003;| a char* (C-style string) |
391wzstring                    | -       | &#10003;| &#10003;| a wchar_t* (C-style string) |
392czstring                    | &#10003;| &#10003;| &#10003;| a const char* (C-style string) |
393cwzstring                   | -       | &#10003;| &#10003;| a const wchar_t* (C-style string) |
394**2.2 Views**               | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
395span<>                      | &#10003;| &#10003;| 1D views| A view of contiguous T's, replace (*,len),<br>see also proposal [p0122](http://wg21.link/p0122) |
396span_p<>                    | &#10003;| -       | -       | A view of contiguous T's that ends at the first element for which predicate(*p) is true |
397make_span()                 | -       | &#10003;| &#10003;| Create a span |
398byte_span()                 | -       | -       | &#10003;| Create a span of bytes from a single object |
399as_bytes()                  | -       | &#10003;| &#10003;| A span as bytes |
400as_writeable_bytes          | -       | &#10003;| &#10003;| A span as writeable bytes |
401basic_string_span<>         | -       | &#10003;| &#10003;| See also proposal [p0123](http://wg21.link/p0123) |
402string_span                 | &#10003;| &#10003;| &#10003;| basic_string_span&lt;char> |
403wstring_span                | -       | &#10003;| &#10003;| basic_string_span&lt;wchar_t > |
404cstring_span                | &#10003;| &#10003;| &#10003;| basic_string_span&lt;const char> |
405cwstring_span               | -       | &#10003;| &#10003;| basic_string_span&lt;const wchar_t > |
406ensure_z()                  | -       | &#10003;| &#10003;| Create a cstring_span or cwstring_span |
407to_string()                 | -       | &#10003;| &#10003;| Convert a string_span to std::string or std::wstring |
408**2.3 Indexing**            | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
409at()                        | &#10003;| &#10003;| >=C++11 | Bounds-checked way of accessing<br>static arrays, std::array, std::vector |
410at()                        | -       | -       | < C++11 | static arrays, std::vector<br>std::array : VC11 |
411**3. Assertions**           | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
412Expects()                   | &#10003;| &#10003;| &#10003;| Precondition assertion |
413Ensures()                   | &#10003;| &#10003;| &#10003;| Postcondition assertion |
414**4. Utilities**            | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
415index                       | &#10003;| &#10003;| &#10003;| type for container indexes, subscripts, sizes,<br>see [Other configuration macros](#other-configuration-macros) |
416byte                        | -       | &#10003;| &#10003;| byte type, see also proposal [p0298](http://wg21.link/p0298) |
417final_action<>              | &#10003;| &#10003;| >=C++11 | Action at the end of a scope |
418final_action                | -       | -       | < C++11 | Currently only void(*)() |
419finally()                   | &#10003;| &#10003;| >=C++11 | Make a final_action<> |
420finally()                   | -       | -       | < C++11 | Make a final_action |
421final_action_return         | -       | -       | < C++11 | Currently only void(*)(), [experimental](#feature-selection-macros) |
422on_return()                 | -       | -       | >=C++11 | Make a final_action_return<>, [experimental](#feature-selection-macros) |
423on_return()                 | -       | -       | < C++11 | Make a final_action_return, [experimental](#feature-selection-macros) |
424final_action_error          | -       | -       | < C++11 | Currently only void(*)(), [experimental](#feature-selection-macros) |
425on_error()                  | -       | -       | >=C++11 | Make a final_action_error<>, [experimental](#feature-selection-macros) |
426on_error()                  | -       | -       | < C++11 | Make a final_action_error, [experimental](#feature-selection-macros) |
427narrow_cast<>               | &#10003;| &#10003;| &#10003;| Searchable narrowing casts of values |
428narrow()                    | &#10003;| &#10003;| &#10003;| Checked version of narrow_cast() |
429implicit                    | &#10003;| -       | &#10003;| Symmetric with explicit |
430move_owner                  | ?       | -       | -       | ... |
431**5. Algorithms**           | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
432copy()                      | &nbsp;  | &nbsp;  | &nbsp;  | Copy from source span to destination span |
433size()                      | &nbsp;  | &nbsp;  | &nbsp;  | Size of span, unsigned |
434ssize()                     | &nbsp;  | &nbsp;  | &nbsp;  | Size of span, signed |
435**6. Concepts**             | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
436...                         | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
437
438Note: GSL Lite treats VC12 (VS2013) and VC14 (VS2015) as C++11 (gsl_CPP11_OR_GREATER: 1).
439
440
441Deprecation
442---------------------
443The following features are deprecated since the indicated version. See macro [`gsl_CONFIG_DEPRECATE_TO_LEVEL`](#other-configuration-macros) on how to control deprecation using the indicated level.
444
445Version | Level | Feature / Notes |
446-------:|:-----:|:----------------|
4470.31.0  |   5   | span( std::nullptr_t, index_type ) |
448&nbsp;  |&nbsp; | span( pointer, index_type ) is used |
4490.31.0  |   5   | span( U *, index_type size ) |
450&nbsp;  |&nbsp; | span( pointer, index_type ) is used |
4510.31.0  |   5   | span( U (&arr)[N] ) |
452&nbsp;  |&nbsp; | span( element_type (&arr)[N] ) is used |
4530.31.0  |   5   | span( std::array< U, N > [const] & arr ) |
454&nbsp;  |&nbsp; | span( std::array< value_type, N > [const] & arr ) is used |
4550.29.0  |   4   | span::span( std::shared_ptr<T> const & p ) |
456&nbsp;  |&nbsp; | Use span( p.get(), p.get() ? 1 : 0 ) or equivalent |
4570.29.0  |   4   | span::span( std::unique_ptr<T> const & p ) |
458&nbsp;  |&nbsp; | Use Use span( p.get(), p.get() ? 1 : 0 ) or equivalent  |
4590.29.0  |   3   | span::length() |
460&nbsp;  |&nbsp; | Use span::size() |
4610.29.0  |   3   | span::length_bytes() |
462&nbsp;  |&nbsp; | Use span::size_bytes() |
4630.17.0  |   2   | member span::as_bytes(), span::as_writeable_bytes() |
464&nbsp;  |&nbsp; | &mdash; |
4650.7.0   |   1   | gsl_CONFIG_ALLOWS_SPAN_CONTAINER_CTOR |
466&nbsp;  |&nbsp; | Use gsl_CONFIG_ALLOWS_UNCONSTRAINED_SPAN_CONTAINER_CTOR,<br>or consider span(with_container, cont). |
467
468
469Reported to work with
470---------------------
471The table below mentions the compiler versions *gsl-lite* is reported to work with.
472
473OS           | Compiler   | Where  | Versions |
474------------:|:-----------|-------:|----------|
475**GNU/Linux**| Clang/LLVM | Travis | 3.4, 3.4, 3.6, 3.7, 3.8, 3.9, 4.0, 5.0 |
476&nbsp;       | GCC        | Travis | 5.4.1, 6.3.0, 7.2.0 |
477**OS X**     | ?          | &nbsp; | ? |
478**Windows**  | Clang/LLVM | &nbsp; | ? |
479&nbsp;       | GCC        | Local  |4.8.4, 4.9.2, 5.2.0, 7.2.0 |
480&nbsp;       | Visual C++<br>(Visual Studio)| Local<br>Local<br>AppVeyor | 6 (6) via header [gsl-lite-vc6.hpp](include/gsl/gsl-lite-vc6.hpp) (not up to date)<br>8 (2005),<br> 10 (2010), 11 (2012), 12 (2013), 14 (2015), 15 (2017) |
481**DOSBox**   | DJGPP      | Local  | DJGPP for GCC 7.2.0 |
482**FreeDOS**  | DJGPP      | Local  | DJGPP for GCC 7.2.0 |
483
484
485Building the tests
486------------------
487To build the tests you need:
488
489- [CMake](http://cmake.org), version 3.0 or later to be installed and in your PATH.
490- A [suitable compiler](#reported-to-work-with).
491
492The [*lest* test framework](https://github.com/martinmoene/lest)  is included in the [test folder](test).
493
494The following steps assume that the [GSL Lite source code](https://github.com/martinmoene/gsl-lite) has been cloned into a directory named `c:\gsl-lite`.
495
4961. Create a directory for the build outputs for a particular architecture.
497Here we use c:\gsl-lite\build-win-x86-vc10.
498
499        cd c:\gsl-lite
500        md build-win-x86-vc10
501        cd build-win-x86-vc10
502
5032. Configure CMake to use the compiler of your choice (run `cmake --help` for a list).
504
505        cmake -G "Visual Studio 10 2010" ..
506
5073. Build the test suite in the Debug configuration (alternatively use Release).
508
509        cmake --build . --config Debug
510
5114. Run the test suite.
512
513        ctest -V -C Debug
514
515All tests should pass, indicating your platform is supported and you are ready to use *gsl-lite*. See the table with [supported types and functions](#features).
516
517
518Other GSL implementations
519-------------------------
520- Microsoft. [Guidelines Support Library (GSL)](https://github.com/microsoft/gsl).
521- Vicente J. Botet Escriba. [Guidelines Support Library (GSL)](https://github.com/viboes/GSL).
522- Mattia Basaglia. CxxMiscLib [gsl.hpp](https://github.com/mbasaglia/Cxx-MiscLib/blob/master/include/misclib/gsl.hpp), [tests](https://github.com/mbasaglia/Cxx-MiscLib/blob/master/test/gsl.cpp).
523
524
525Notes and references
526--------------------
527### Proposals, specification
528[1] [span on cppreference](http://en.cppreference.com/w/cpp/string/span).
529[2] [span in C++20 Working Draft](http://eel.is/c++draft/views).
530[3] [p0091 - Template argument deduction for class templates](http://wg21.link/p0091).
531[4] [p0122 - span: bounds-safe views for sequences of objects](http://wg21.link/p0122).
532[5] [p0123 - string_span: bounds-safe views for sequences of characters ](http://wg21.link/p0123).
533[6] [p0298 - A byte type definition](http://wg21.link/p0298).
534[7] [p0805 - Comparing Containers](http://wg21.link/p0805).
535
536### Articles
537[8] [Standard C++ Foundation](https://isocpp.org/).
538[9] Standard C++ Foundation. [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines).
539[10] Microsoft. [Guidelines Support Library (GSL)](https://github.com/microsoft/gsl).
540[11] Bjarne Stroustrup. [Writing good C++14 (PDF)](https://github.com/isocpp/CppCoreGuidelines/raw/master/talks/Stroustrup%20-%20CppCon%202015%20keynote.pdf) &mdash; [Video](https://www.youtube.com/watch?t=9&v=1OEu9C51K2A). CppCon 2015.
541[12] Herb Sutter. [Writing good C++14&hellip; By default (PDF)](https://github.com/isocpp/CppCoreGuidelines/raw/master/talks/Sutter%20-%20CppCon%202015%20day%202%20plenary%20.pdf) &mdash; [Video](https://www.youtube.com/watch?v=hEx5DNLWGgA). CppCon 2015.
542[13] Gabriel Dos Reis. [Contracts for Dependable C++ (PDF)](https://github.com/isocpp/CppCoreGuidelines/raw/master/talks/Contracts-for-Dependable-C%2B%2B.pdf)  &mdash; Video. CppCon 2015.
543[14] Bjarne Stroustrup et al. [A brief introduction to C++’s model for type- and resource-safety](https://github.com/isocpp/CppCoreGuidelines/raw/master/docs/Introduction%20to%20type%20and%20resource%20safety.pdf).
544[15] Herb Sutter and Neil MacIntosh. [Lifetime Safety: Preventing Leaks and Dangling](https://github.com/isocpp/CppCoreGuidelines/raw/master/docs/Lifetimes%20I%20and%20II%20-%20v0.9.1.pdf). 21 Sep 2015.
545
546### Compiler feature testing
547[16] cppreference.com. [Feature Test Recommendations](http://en.cppreference.com/w/cpp/experimental/feature_test).
548[17] cppreference.com. [Feature testing macros](http://en.cppreference.com/w/User:D41D8CD98F/feature_testing_macros).
549
550### C++ features in various Visual C++ compilers
551[18] Visual CPP Team. [C++0x Core Language Features In VC10: The Table](http://blogs.msdn.com/b/vcblog/archive/2010/04/06/c-0x-core-language-features-in-vc10-the-table.aspx). Microsoft. 6 April 2010.
552[19] Visual CPP Team. [C++11 Features in Visual C++ 11](http://blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.aspx). Microsoft. 12 September 2011.
553[20] Joel Coehoorn. [C++11 features in Visual Studio 2012](http://stackoverflow.com/a/7422058/437272). StackOverflow. 14 September 2011.
554[21] Stephan T. Lavavej. [C++11/14 Features In Visual Studio 14 CTP3](http://blogs.msdn.com/b/vcblog/archive/2014/08/21/c-11-14-features-in-visual-studio-14-ctp3.aspx). Microsoft. 21 August 2014.
555[22] Stephan T. Lavavej. [C++11/14/17 Features In VS 2015 RTM](http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx). Microsoft. 19 June 2015.
556
557Appendix
558--------
559
560**Contents**
561- [A.1 Extract Boost smart pointers](#a1)
562- [A.2 Compile-time information](#a2)
563- [A.3 GSL Lite test specification](#a3)
564
565<a id="a1"></a>
566### A.1 Extract Boost smart pointers
567
568To obtain a subset of Boost only containing the smart pointers, use the [bcp command](http://www.boost.org/doc/libs/1_59_0/tools/bcp/doc/html/index.html) like:
569
570    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
571
572The smart pointers of Boost 1.51 can be used with VC6.
573
574<a id="a2"></a>
575### A.2 Compile-time information
576
577The 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]`.
578
579<a id="a3"></a>
580### A.3 GSL Lite test specification
581
582```
583Expects(): Allows a true expression
584Ensures(): Allows a true expression
585Expects(): Terminates on a false expression
586Ensures(): Terminates on a false expression
587at(): Terminates access to non-existing C-array elements
588at(): Terminates access to non-existing std::array elements (C++11)
589at(): Terminates access to non-existing std::vector elements
590at(): Terminates access to non-existing std::initializer_list elements (C++11)
591at(): Terminates access to non-existing gsl::span elements
592at(): Allows to access existing C-array elements
593at(): Allows to access existing std::array elements (C++11)
594at(): Allows to access existing std::vector elements
595at(): Allows to access std::initializer_list elements (C++11)
596at(): Allows to access gsl::span elements
597byte: Allows to construct from integral via static cast (C++17)
598byte: Allows to construct from integral via byte() (C++17)
599byte: Allows to construct from integral via to_byte()
600byte: Allows to convert to integral via to_integer()
601byte: Allows comparison operations
602byte: Allows bitwise or operation
603byte: Allows bitwise and operation
604byte: Allows bitwise x-or operation
605byte: Allows bitwise or assignment
606byte: Allows bitwise and assignment
607byte: Allows bitwise x-or assignment
608byte: Allows shift-left operation
609byte: Allows shift-right operation
610byte: Allows shift-left assignment
611byte: Allows shift-right assignment
612byte: Provides constexpr non-assignment operations (C++11)
613byte: Provides constexpr assignment operations (C++14)
614byte: Provides hash support (C++11)
615not_null<>: Disallows default construction (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
616not_null<>: Disallows construction from nullptr_t, NULL or 0 (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
617not_null<>: Disallows construction from a unique pointer to underlying type (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
618not_null<>: Disallows assignment from unrelated pointers (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
619not_null<>: Terminates construction from a null pointer value
620not_null<>: Terminates construction from related pointer types for null pointer value
621not_null<>: Terminates assignment from a null pointer value
622not_null<>: Terminates assignment from related pointer types for null pointer value
623not_null<>: Allows to construct from a non-null underlying pointer
624not_null<>: Allows to construct from a non-null user-defined ref-counted type
625not_null<>: Allows to construct from a non-null related pointer
626not_null<>: Allows to construct from a not_null related pointer type
627not_null<>: Allows assignment from a not_null related pointer type
628not_null<>: Allows assignment from a non-null bare recast pointer
629not_null<>: Allows implicit conversion to underlying type
630not_null<>: Allows indirect member access
631not_null<>: Allows dereferencing
632not_null<>: Allows to compare equal to another not_null of the same type
633not_null<>: Allows to compare unequal to another not_null of the same type
634not_null<>: Allows to compare less than another not_null of the same type
635not_null<>: Allows to compare less than or equal to another not_null of the same type
636not_null<>: Allows to compare greater than another not_null of the same type
637not_null<>: Allows to compare greater than or equal to another not_null of the same type
638not_null<>: Allows to compare equal to a raw pointer of the same type
639not_null<>: Allows to compare unequal to a raw pointer of the same type
640not_null<>: Allows to compare less than a raw pointer of the same type
641not_null<>: Allows to compare less than or equal to a raw pointer of the same type
642not_null<>: Allows to compare greater than a raw pointer of the same type
643not_null<>: Allows to compare greater than or equal to a raw pointer of the same type
644owner<>: Disallows construction from a non-pointer type (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
645owner<>: Allows its use as the (pointer) type it stands for
646Owner(): Allows its use as the (pointer) type it stands for
647span<>: Disallows construction from a temporary value (C++11) (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
648span<>: Disallows construction from a C-array of incompatible type (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
649span<>: Disallows construction from a std::array of incompatible type (C++11) (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
650span<>: Terminates construction from a nullptr and a non-zero size (C++11)
651span<>: Terminates construction from two pointers in the wrong order
652span<>: Terminates construction from a null pointer and a non-zero size
653span<>: Terminates creation of a sub span of the first n elements for n exceeding the span
654span<>: Terminates creation of a sub span of the last n elements for n exceeding the span
655span<>: Terminates creation of a sub span outside the span
656span<>: Terminates access outside the span
657span<>: Allows to default-construct
658span<>: Allows to construct from a nullptr and a zero size (C++11)
659span<>: Allows to construct from a single object (C++11)
660span<>: Allows to construct from a const single object (C++11)
661span<>: Allows to construct from two pointers
662span<>: Allows to construct from two pointers to const
663span<>: Allows to construct from a non-null pointer and a size
664span<>: Allows to construct from a non-null pointer to const and a size
665span<>: Allows to construct from a temporary pointer and a size
666span<>: Allows to construct from a temporary pointer to const and a size
667span<>: Allows to construct from any pointer and a zero size
668span<>: Allows to construct from a C-array
669span<>: Allows to construct from a const C-array
670span<>: Allows to construct from a C-array with size via decay to pointer (potentially dangerous)
671span<>: Allows to construct from a const C-array with size via decay to pointer (potentially dangerous)
672span<>: Allows to construct from a std::array<> (C++11)
673span<>: Allows to construct from a std::array<> with const data (C++11) [deprecated-5]
674span<>: Allows to construct from a container (std::vector<>)
675span<>: Allows to construct from a temporary container (potentially dangerous)
676span<>: Allows to tag-construct from a container (std::vector<>)
677span<>: Allows to tag-construct from a temporary container (potentially dangerous)
678span<>: Allows to construct from an empty gsl::shared_ptr (C++11) [deprecated-4]
679span<>: Allows to construct from an empty gsl::unique_ptr (C++11) [deprecated-4]
680span<>: Allows to construct from an empty gsl::unique_ptr (array, C++11) [deprecated-4]
681span<>: Allows to construct from a non-empty gsl::shared_ptr (C++11) [deprecated-4]
682span<>: Allows to construct from a non-empty gsl::unique_ptr (C++11) [deprecated-4]
683span<>: Allows to construct from a non-empty gsl::unique_ptr (array, C++11) [deprecated-4]
684span<>: Allows to copy-construct from another span of the same type
685span<>: Allows to copy-construct from another span of a compatible type
686span<>: Allows to move-construct from another span of the same type (C++11)
687span<>: Allows to copy-assign from another span of the same type
688span<>: Allows to move-assign from another span of the same type (C++11)
689span<>: Allows to create a sub span of the first n elements
690span<>: Allows to create a sub span of the last n elements
691span<>: Allows to create a sub span starting at a given offset
692span<>: Allows to create a sub span starting at a given offset with a given length
693span<>: Allows to create an empty sub span at full offset
694span<>: Allows to create an empty sub span at full offset with zero length
695span<>: Allows forward iteration
696span<>: Allows const forward iteration
697span<>: Allows reverse iteration
698span<>: Allows const reverse iteration
699span<>: Allows to observe an element via array indexing
700span<>: Allows to observe an element via call indexing
701span<>: Allows to observe an element via at()
702span<>: Allows to observe an element via data()
703span<>: Allows to change an element via array indexing
704span<>: Allows to change an element via call indexing
705span<>: Allows to change an element via at()
706span<>: Allows to change an element via data()
707span<>: Allows to compare equal to another span of the same type
708span<>: Allows to compare unequal to another span of the same type
709span<>: Allows to compare less than another span of the same type
710span<>: Allows to compare less than or equal to another span of the same type
711span<>: Allows to compare greater than another span of the same type
712span<>: Allows to compare greater than or equal to another span of the same type
713span<>: Allows to compare to another span of the same type and different cv-ness (non-standard)
714span<>: Allows to compare empty spans as equal
715span<>: Allows to test for empty span via empty(), empty case
716span<>: Allows to test for empty span via empty(), non-empty case
717span<>: Allows to obtain the number of elements via size(), as configured
718span<>: Allows to obtain the number of elements via ssize(), signed
719span<>: Allows to obtain the number of elements via length() [deprecated-3]
720span<>: Allows to obtain the number of bytes via size_bytes()
721span<>: Allows to obtain the number of bytes via length_bytes() [deprecated-3]
722span<>: Allows to swap with another span of the same type
723span<>: Allows to view the elements as read-only bytes [deprecated-2 as member]
724span<>: Allows to view and change the elements as writable bytes [deprecated-2 as member]
725span<>: Allows to view the elements as a span of another type
726span<>: Allows to change the elements from a span of another type
727copy(): Allows to copy a span to another span of the same element type
728copy(): Allows to copy a span to another span of a different element type
729size(): Allows to obtain the number of elements in span via size(span), unsigned
730ssize(): Allows to obtain the number of elements in span via ssize(span), signed
731make_span(): (gsl_FEATURE_MAKE_SPAN=1)
732make_span(): Allows to build from two pointers
733make_span(): Allows to build from two const pointers
734make_span(): Allows to build from a non-null pointer and a size
735make_span(): Allows to build from a non-null const pointer and a size
736make_span(): Allows to build from a C-array
737make_span(): Allows to build from a const C-array
738make_span(): Allows to build from a std::array<> (C++11)
739make_span(): Allows to build from a const std::array<> (C++11)
740make_span(): Allows to build from a container (std::vector<>)
741make_span(): Allows to build from a const container (std::vector<>)
742make_span(): Allows to build from a temporary container (potentially dangerous)
743make_span(): Allows to tag-build from a container (std::vector<>)
744make_span(): Allows to tag-build from a temporary container (potentially dangerous)
745make_span(): Allows to build from an empty gsl::shared_ptr (C++11) [deprecated-4]
746make_span(): Allows to build from an empty gsl::unique_ptr (C++11) [deprecated-4]
747make_span(): Allows to build from an empty gsl::unique_ptr (array, C++11) [deprecated-4]
748make_span(): Allows to build from a non-empty gsl::shared_ptr (C++11) [deprecated-4]
749make_span(): Allows to build from a non-empty gsl::unique_ptr (C++11) [deprecated-4]
750make_span(): Allows to build from a non-empty gsl::unique_ptr (array, C++11) [deprecated-4]
751byte_span() (gsl_FEATURE_BYTE_SPAN=1)
752byte_span(): Allows to build a span of gsl::byte from a single object
753byte_span(): Allows to build a span of const gsl::byte from a single const object
754string_span: Disallows construction of a string_span from a cstring_span (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
755string_span: Disallows construction of a string_span from a const std::string (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
756string_span: Allows to default-construct
757string_span: Allows to construct from a nullptr (C++11)
758string_span: Allows to construct a cstring_span from a const C-string
759string_span: Allows to construct a string_span from a non-const C-string and size
760string_span: Allows to construct a string_span from a non-const C-string begin and end pointer
761string_span: Allows to construct a string_span from a non-const C-array
762string_span: Allows to construct a string_span from a non-const std::string
763string_span: Allows to construct a string_span from a non-const std::array (C++11)
764string_span: Allows to construct a string_span from a non-const container (std::vector)
765string_span: Allows to construct a string_span from a non-const container, via a tag (std::vector)
766string_span: Allows to construct a cstring_span from a non-const C-string and size
767string_span: Allows to construct a cstring_span from a non-const C-string begin and end pointer
768string_span: Allows to construct a cstring_span from a non-const C-array
769string_span: Allows to construct a cstring_span from a non-const std::string
770string_span: Allows to construct a cstring_span from a non-const std::array (C++11)
771string_span: Allows to construct a cstring_span from a non-const container (std::vector)
772string_span: Allows to construct a cstring_span from a non-const container, via a tag (std::vector)
773string_span: Allows to construct a cstring_span from a const C-string and size
774string_span: Allows to construct a cstring_span from a non-const C-string begin and end pointer
775string_span: Allows to construct a cstring_span from a const C-array
776string_span: Allows to construct a cstring_span from a const std::string
777string_span: Allows to construct a cstring_span from a const std::array (C++11)
778string_span: Allows to construct a cstring_span from a const container (std::vector)
779string_span: Allows to construct a cstring_span from a const container, via a tag (std::vector)
780string_span: Allows to construct a wstring_span from a non-const C-string and size
781string_span: Allows to construct a wstring_span from a non-const C-string begin and end pointer
782string_span: Allows to construct a wstring_span from a non-const C-array
783string_span: Allows to construct a wstring_span from a non-const std::wstring
784string_span: Allows to construct a wstring_span from a non-const std::array (C++11)
785string_span: Allows to construct a wstring_span from a non-const container (std::vector)
786string_span: Allows to construct a wstring_span from a non-const container, via a tag (std::vector)
787string_span: Allows to construct a cwstring_span from a non-const C-string and size
788string_span: Allows to construct a cwstring_span from a non-const C-string begin and end pointer
789string_span: Allows to construct a cwstring_span from a non-const C-array
790string_span: Allows to construct a cwstring_span from a non-const std::wstring
791string_span: Allows to construct a cwstring_span from a non-const std::array (C++11)
792string_span: Allows to construct a cwstring_span from a non-const container (std::vector)
793string_span: Allows to construct a cwstring_span from a non-const container, via a tag (std::vector)
794string_span: Allows to construct a cwstring_span from a const C-string and size
795string_span: Allows to construct a cwstring_span from a const C-string begin and end pointer
796string_span: Allows to construct a cwstring_span from a const C-array
797string_span: Allows to construct a cwstring_span from a const std::wstring
798string_span: Allows to construct a cwstring_span from a const std::array (C++11)
799string_span: Allows to construct a cwstring_span from a const container (std::vector)
800string_span: Allows to construct a cwstring_span from a const container, via a tag (std::vector)
801string_span: Allows to copy-construct from another span of the same type
802string_span: Allows to copy-construct from another span of a compatible type
803string_span: Allows to move-construct from another span of the same type (C++11)
804string_span: Allows to copy-assign from another span of the same type
805string_span: Allows to move-assign from another span of the same type (C++11)
806string_span: Allows to create a sub span of the first n elements
807string_span: Allows to create a sub span of the last n elements
808string_span: Allows to create a sub span starting at a given offset
809string_span: Allows to create a sub span starting at a given offset with a given length
810string_span: Allows to create an empty sub span at full offset
811string_span: Allows to create an empty sub span at full offset with zero length
812string_span: Allows forward iteration
813string_span: Allows const forward iteration
814string_span: Allows reverse iteration
815string_span: Allows const reverse iteration
816string_span: Allows to observe an element via array indexing
817string_span: Allows to observe an element via call indexing
818string_span: Allows to observe an element via data()
819string_span: Allows to change an element via array indexing
820string_span: Allows to change an element via call indexing
821string_span: Allows to change an element via data()
822string_span: Allows to compare a string_span with another string_span
823string_span: Allows to compare empty span to non-empty span
824string_span: Allows to compare a string_span with a cstring_span
825string_span: Allows to compare with types convertible to string_span
826string_span: Allows to test for empty span via empty(), empty case
827string_span: Allows to test for empty span via empty(), non-empty case
828string_span: Allows to obtain the number of elements via length()
829string_span: Allows to obtain the number of elements via size()
830string_span: Allows to obtain the number of bytes via length_bytes()
831string_span: Allows to obtain the number of bytes via size_bytes()
832string_span: Allows to view the elements as read-only bytes
833to_string(): Allows to explicitly convert from string_span to std::string
834to_string(): Allows to explicitly convert from cstring_span to std::string
835to_string(): Allows to explicitly convert from wstring_span to std::wstring
836to_string(): Allows to explicitly convert from cwstring_span to std::wstring
837ensure_z(): Disallows to build a string_span from a const C-string
838ensure_z(): Disallows to build a wstring_span from a const wide C-string
839ensure_z(): Allows to build a string_span from a non-const C-string
840ensure_z(): Allows to build a cstring_span from a non-const C-string
841ensure_z(): Allows to build a cstring_span from a const C-string
842ensure_z(): Allows to build a wstring_span from a non-const wide C-string
843ensure_z(): Allows to build a cwstring_span from a non-const wide C-string
844ensure_z(): Allows to build a cwstring_span from a const wide C-string
845ensure_z(): Allows to specify ultimate location of the sentinel and ensure its presence
846operator<<: Allows printing a string_span to an output stream
847operator<<: Allows printing a cstring_span to an output stream
848operator<<: Allows printing a wstring_span to an output stream
849operator<<: Allows printing a cwstring_span to an output stream
850finally: Allows to run lambda on leaving scope
851finally: Allows to run function (bind) on leaving scope
852finally: Allows to run function (pointer) on leaving scope
853finally: Allows to move final_action
854on_return: Allows to perform action on leaving scope without exception (gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD)
855on_error: Allows to perform action on leaving scope via an exception (gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD)
856narrow_cast<>: Allows narrowing without value loss
857narrow_cast<>: Allows narrowing with value loss
858narrow<>(): Allows narrowing without value loss
859narrow<>(): Terminates when narrowing with value loss
860narrow<>(): Terminates when narrowing with sign loss
861```
862