Name Date Size

..11-Feb-20204 KiB

.gitattributesH A D11-Feb-2020556

.gitignoreH A D11-Feb-2020242

.travis.ymlH A D11-Feb-2020366

CHANGES.txtH A D11-Feb-20209.7 KiB

CMakeLists.txtH A D11-Feb-2020448

example/H11-Feb-20204 KiB

gsl-lite.natvisH A D11-Feb-20201.4 KiB

include/H11-Feb-20204 KiB

LICENSEH A D11-Feb-20201.1 KiB

project/H11-Feb-20204 KiB

README.mdH A D11-Feb-202035.5 KiB

test/H11-Feb-20204 KiB

README.md

1# GSL Lite: Guideline Support Library for C++98, C++11 up
2
3[![Standard](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%20version%20%20-download-blue.svg)](https://raw.githubusercontent.com/martinmoene/gsl-lite/master/include/gsl/gsl-lite.h) [![Try it online](https://img.shields.io/badge/try%20it-online-blue.svg)](https://wandbox.org/permlink/IVlf9Z5zGk3BPZ1q) [![Godbolt online](https://img.shields.io/badge/godbolt-online-blue.svg)](https://godbolt.org/g/iEAxnY)
4
5
6GSL Lite is based on the [Microsoft Guideline 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](#installation)
14- [Synopsis](#synopsis)
15- [Features](#features)
16- [Reported to work with](#reported-to-work-with)
17- [Building the tests](#building-the-tests)
18- [Other GSL implementations](#other-gsl-implementations)
19- [Notes and references](#notes-and-references)
20- [Appendix](#appendix)
21
22
23Example usage
24-------------
25
26```Cpp
27#include "gsl-lite.h"
28
29using namespace gsl;
30
31int * use( not_null<int *> p ) 
32{
33    // use p knowing it's not nullptr, NULL or 0.
34    
35    return p;
36}
37
38struct Widget
39{
40    Widget() : owned_ptr( new int(42) ) {}
41    ~Widget() { delete owned_ptr; }
42
43    void work() { non_owned_ptr = use( owned_ptr ); }
44    
45    owner<int *> owned_ptr;	// if alias template support
46//  Owner(int *) owned_ptr;	// C++98 up
47    int * non_owned_ptr;
48};
49
50int main()
51{
52    Widget w;
53    w.work();
54}
55```
56
57### Compile and run
58
59```
60prompt>g++ -std=c++03 -Wall -I../include/gsl -o 01-basic.exe 01-basic.cpp && 01-basic.exe
61```
62
63In a nutshell
64-------------
65**gsl-lite** is a single-file header-only variant of Microsoft's implementation of the [Guideline 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. 
66
67The Guideline 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).
68
69*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).
70
71
72License
73-------
74*gsl-lite* uses the [MIT](LICENSE) license.
75 
76
77Dependencies
78------------
79*gsl-lite* has no other dependencies than the [C++ standard library](http://en.cppreference.com/w/cpp/header).
80
81
82Installation
83------------
84*gsl-lite* is a single-file header-only library. Put `gsl-lite.h` in the [include](include) folder directly into the project source tree or somewhere reachable from your project.
85
86
87Synopsis
88--------
89
90**Contents**  
91- [API macro](#api-macro)
92- [Feature selection macros](#feature-selection-macros)
93- [Contract violation response macros](#contract-violation-response-macros)
94- [Microsoft GSL compatibility macros](#microsoft-gsl-compatibility-macros)
95- [Other configuration macros](#other-configuration-macros)
96
97### API macro
98
99\-D<b>gsl\_api</b>=""  
100Functions (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. 
101
102### Feature selection macros
103
104\-D<b>gsl\_FEATURE\_HAVE\_IMPLICIT\_MACRO</b>=1  
105Define this macro to 0 to omit the `implicit` macro. Default is 1.
106
107\-D<b>gsl\_FEATURE\_HAVE\_OWNER\_MACRO</b>=1  
108At 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.
109
110\-D<b>gsl\_FEATURE\_EXPERIMENTAL\_RETURN\_GUARD</b>=0  
111Provide experimental types `final_act_return` and `final_act_error` and convenience functions `on_return()` and `on_error()`. Default is 0.
112
113### Contract violation response macros
114
115*gsl-lite* provides contract violation response control as suggested in proposal [N4415](http://wg21.link/n4415).
116
117\-D<b>gsl\_CONFIG\_CONTRACT\_LEVEL\_ON</b>  
118Define this macro to include both `Expects` and `Ensures` in the code. This is the default case.
119 
120\-D<b>gsl\_CONFIG\_CONTRACT\_LEVEL\_OFF</b>  
121Define this macro to exclude both `Expects` and `Ensures` from the code.
122
123\-D<b>gsl\_CONFIG_CONTRACT\_LEVEL\_EXPECTS\_ONLY</b>  
124Define this macro to include `Expects` in the code and exclude `Ensures` from the code.
125
126\-D<b>gsl\_CONFIG\_CONTRACT\_LEVEL\_ENSURES\_ONLY</b>  
127Define this macro to exclude `Expects` from the code and include `Ensures` in the code.
128
129\-D<b>gsl\_CONFIG\_CONTRACT\_VIOLATION\_TERMINATES</b>  
130Define this macro to call `std::terminate()` on a GSL contract violation in `Expects`, `Ensures` and `narrow`. This is the default case.
131
132\-D<b>gsl\_CONFIG\_CONTRACT\_VIOLATION\_THROWS</b>  
133Define 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`.
134
135### Microsoft GSL compatibility macros
136
137\-D<b>GSL_UNENFORCED_ON_CONTRACT_VIOLATION</b>  
138Equivalent to -Dgsl_CONFIG_CONTRACT_LEVEL_OFF.
139
140\-D<b>GSL\_THROW\_ON\_CONTRACT\_VIOLATION</b>  
141Equivalent to -Dgsl\_CONFIG\_CONTRACT\_VIOLATION\_THROWS.
142
143\-D<b>GSL\_TERMINATE\_ON\_CONTRACT\_VIOLATION</b>  
144Equivalent to -Dgsl\_CONFIG\_CONTRACT\_VIOLATION\_TERMINATES.
145
146### Other configuration macros
147
148\-D<b>gsl\_CONFIG\_SPAN\_INDEX\_TYPE</b>=size_t
149Define 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`.
150
151\-D<b>gsl\_CONFIG\_ALLOWS\_NONSTRICT\_SPAN\_COMPARISON</b>=1  
152Define 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.
153
154\-D<b>gsl\_CONFIG\_ALLOWS\_UNCONSTRAINED\_SPAN\_CONTAINER\_CTOR</b>=0  
155Define 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.
156
157Note: an alternative is to use the constructor tagged `with_container`: span&lt;_value_type_> *s*(with_container, *cont*). 
158
159\-D<b>gsl\_CONFIG\_CONFIRMS\_COMPILATION\_ERRORS</b>=0  
160Define this macro to 1 to experience the by-design compile-time errors of the GSL components in the test suite. Default is 0.
161
162
163Features
164--------
165See also section [GSL: Guideline support library](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#S-gsl) of the C++ Core Guidelines [2]. 
166
167Feature / library           | GSL     | M-GSL   | GSL-Lite| Notes |
168----------------------------|:-------:|:-------:|:-------:|:------|
169**1.Lifetime&nbsp;safety**  | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
170**1.1 Indirection**         | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
171not_null<>                  | &#10003;| &#10003;| &#10003;| Wrap any indirection and enforce non-null |
172**1.2 Ownership**           | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
173owner<>                     | &#10003;| &#10003;| >=C++11 | Owned raw pointers |
174Owner()                     | -       | -       | &#10003;| Macro for pre-C++11;<br>see also [Feature selection macros](#feature-selection-macros) |
175unique_ptr<>                | &#10003;| &#10003;| >=C++11 | std::unique_ptr<> |
176unique_ptr<>                | -       | -       | < C++11 | VC10, VC11 |
177shared_ptr<>                | &#10003;| &#10003;| >=C++11 | std::shared_ptr<> |
178shared_ptr<>                | -       | -       | < C++11 | VC10, VC11<br>see also [Extract Boost smart pointers](#a1-extract-boost-smart-pointers) |
179stack_array<>               | &#10003;| -       | -       | A stack-allocated array, fixed size |
180dyn_array<>                 | ?       | -       | -       | A heap-allocated array, fixed size |
181**2.Bounds&nbsp;safety**    | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
182**2.1 Tag Types**           | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
183zstring                     | &#10003;| &#10003;| &#10003;| a char* (C-style string) |
184wzstring                    | -       | &#10003;| &#10003;| a wchar_t* (C-style string) |
185czstring                    | &#10003;| &#10003;| &#10003;| a const char* (C-style string) |
186cwzstring                   | -       | &#10003;| &#10003;| a const wchar_t* (C-style string) |
187**2.2 Views**               | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
188span<>                      | &#10003;| &#10003;| 1D views| A view of contiguous T's, replace (*,len) |
189span_p<>                    | &#10003;| -       | -       | A view of contiguous T's that ends at the first element for which predicate(*p) is true |
190make_span()                 | -       | &#10003;| &#10003;| Create a span |
191as_bytes()                  | -       | &#10003;| &#10003;| A span as bytes |
192as_writeable_bytes          | -       | &#10003;| &#10003;| A span as writeable bytes |
193basic_string_span<>         | -       | &#10003;| &#10003;| See also propasal [p0123](http://wg21.link/p0123) |
194string_span                 | &#10003;| &#10003;| &#10003;| basic_string_span&lt;char> |
195wstring_span                | -       | &#10003;| &#10003;| basic_string_span&lt;wchar_t > |
196cstring_span                | &#10003;| &#10003;| &#10003;| basic_string_span&lt;const char> |
197cwstring_span               | -       | &#10003;| &#10003;| basic_string_span&lt;const wchar_t > |
198ensure_z()                  | -       | &#10003;| &#10003;| Create a cstring_span or cwstring_span |
199to_string()                 | -       | &#10003;| &#10003;| Convert a string_span to std::string or std::wstring |
200**2.3 Indexing**            | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
201at()                        | &#10003;| &#10003;| >=C++11 | Bounds-checked way of accessing<br>static arrays, std::array, std::vector |
202at()                        | -       | -       | < C++11 | static arrays, std::vector<br>std::array : VC11 |
203**3. Assertions**           | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
204Expects()                   | &#10003;| &#10003;| &#10003;| Precondition assertion |
205Ensures()                   | &#10003;| &#10003;| &#10003;| Postcondition assertion |
206**4. Utilities**            | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
207byte                        | -       | &#10003;| &#10003;| byte type, see also proposal [p0298](http://wg21.link/p0298) |
208final_act<>                 | &#10003;| &#10003;| >=C++11 | Action at the end of a scope |
209final_act                   | -       | -       | < C++11 | Currently only void(*)() |
210finally()                   | &#10003;| &#10003;| >=C++11 | Make a final_act<> |
211finally()                   | -       | -       | < C++11 | Make a final_act |
212final_act_return            | -       | -       | < C++11 | Currently only void(*)(), [experimental](#feature-selection-macros) |
213on_return()                 | -       | -       | >=C++11 | Make a final_act_return<>, [experimental](#feature-selection-macros) |
214on_return()                 | -       | -       | < C++11 | Make a final_act_return, [experimental](#feature-selection-macros) |
215final_act_error             | -       | -       | < C++11 | Currently only void(*)(), [experimental](#feature-selection-macros) |
216on_error()                  | -       | -       | >=C++11 | Make a final_act_error<>, [experimental](#feature-selection-macros) |
217on_error()                  | -       | -       | < C++11 | Make a final_act_error, [experimental](#feature-selection-macros) |
218narrow_cast<>               | &#10003;| &#10003;| &#10003;| Searchable narrowing casts of values |
219narrow()                    | &#10003;| &#10003;| &#10003;| Checked version of narrow_cast() |
220implicit                    | &#10003;| -       | &#10003;| Symmetric with explicit |
221move_owner                  | ?       | -       | -       | ... |
222**5. Algorithms**           | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
223copy()                      | &nbsp;  | &nbsp;  | &nbsp;  | Copy from source span to destination span |
224**6. Concepts**             | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
225...                         | &nbsp;  | &nbsp;  | &nbsp;  | &nbsp; |
226
227Note: GSL Lite treats VC12 (VS2013) and VC14 (VS2015) as C++11 (gsl_CPP11_OR_GREATER: 1).
228
229
230Reported to work with
231---------------------
232The table below mentions the compiler versions *gsl-lite* is reported to work with.
233
234OS        | Compiler   | Versions |
235---------:|:-----------|:---------|
236Windows   | Clang/LLVM | ? |
237&nbsp;    | GCC        | 4.8.4, 4.9.2, 5.2.0 |
238&nbsp;    | Visual C++<br>(Visual Studio)| 6 (6) via header [gsl-lite-vc6.h](include/gsl/gsl-lite-vc6.h)<br>8 (2005), 10 (2010), 11 (2012),<br>12 (2013), 14 (2015) |
239GNU/Linux | Clang/LLVM | 3.4 |
240&nbsp;    | GCC        | 5.1 |
241OS X      | ?          | ?   |
242
243
244Building the tests
245------------------
246To build the tests you need:
247
248- [CMake](http://cmake.org), version 2.8.7 or later to be installed and in your PATH.
249- A [suitable compiler](#reported-to-work-with). 
250
251The [*lest* test framework](https://github.com/martinmoene/lest)  is included in the [test folder](test).
252 
253The 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`.
254
2551. Create a directory for the build outputs for a particular architecture.  
256Here we use c:\gsl-lite\build-win-x86-vc10.
257
258        cd c:\gsl-lite
259        md build-win-x86-vc10
260        cd build-win-x86-vc10
261
2622. Configure CMake to use the compiler of your choice (run `cmake --help` for a list).
263
264        cmake -G "Visual Studio 10 2010" ..
265
2663. Build the test suite in the Debug configuration (alternatively use Release).    
267
268        cmake --build . --config Debug
269
2704. Run the test suite.    
271
272        ctest -V -C Debug
273
274All 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).
275
276
277Other GSL implementations
278-------------------------
279- Microsoft. [Guideline Support Library (GSL)](https://github.com/microsoft/gsl).
280- Vicente J. Botet Escriba. [Guideline Support Library (GSL)](https://github.com/viboes/GSL).
281- 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).
282
283
284Notes and references
285--------------------
286### References
287[1] [Standard C++ Foundation](https://isocpp.org/).  
288[2] Standard C++ Foundation. [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines).  
289[3] Microsoft. [Guideline Support Library (GSL)](https://github.com/microsoft/gsl).  
290[4] 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.  
291[5] 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.  
292[6] 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.  
293[7] 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).  
294[8] 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.
295
296### Compiler feature testing
297[9] cppreference.com. [Feature Test Recommendations](http://en.cppreference.com/w/cpp/experimental/feature_test).  
298[10] cppreference.com. [Feature testing macros](http://en.cppreference.com/w/User:D41D8CD98F/feature_testing_macros).  
299
300### C++ features in various Visual C++ compilers
301[11] 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.  
302[12] 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.  
303[13] Joel Coehoorn. [C++11 features in Visual Studio 2012](http://stackoverflow.com/a/7422058/437272). StackOverflow. 14 September 2011.  
304[14] 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.  
305[15] 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.  
306
307Appendix
308--------
309### A.1 Extract Boost smart pointers
310
311To 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:
312
313    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
314
315The smart pointers of Boost 1.51 can be used with VC6.
316
317### A.2 GSL Lite test specification
318
319```
320Expects(): Allows a true expression
321Ensures(): Allows a true expression
322Expects(): Terminates on a false expression
323Ensures(): Terminates on a false expression
324at(): Terminates access to non-existing C-array elements
325at(): Terminates access to non-existing std::array elements (C++11)
326at(): Terminates access to non-existing std::vector elements
327at(): Terminates access to non-existing std::initializer_list elements (C++11)
328at(): Terminates access to non-existing gsl::span elements
329at(): Allows to access existing C-array elements
330at(): Allows to access existing std::array elements (C++11)
331at(): Allows to access existing std::vector elements
332at(): Allows to access std::initializer_list elements (C++11)
333at(): Allows to access gsl::span elements
334byte: Allows to construct from integral via static cast (C++17)
335byte: Allows to construct from integral via byte() (C++17)
336byte: Allows to construct from integral via to_byte()
337byte: Allows to convert to integral via to_integer()
338byte: Allows comparison operations
339byte: Allows bitwise or operation
340byte: Allows bitwise and operation
341byte: Allows bitwise x-or operation
342byte: Allows bitwise or assignment
343byte: Allows bitwise and assignment
344byte: Allows bitwise x-or assignment
345byte: Allows shift-left operation
346byte: Allows shift-right operation
347byte: Allows shift-left assignment
348byte: Allows shift-right assignment
349byte: Provides constexpr non-assignment operations (C++11)
350byte: Provides constexpr assignment operations (C++14)
351byte: Provides hash support (C++11)
352not_null<>: Disallows default construction (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
353not_null<>: Disallows construction from nullptr_t, NULL or 0 (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
354not_null<>: Disallows construction from a unique pointer to underlying type (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
355not_null<>: Disallows assignment from unrelated pointers (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
356not_null<>: Terminates construction from a null pointer value
357not_null<>: Terminates construction from related pointer types for null pointer value
358not_null<>: Terminates assignment from a null pointer value
359not_null<>: Terminates assignment from related pointer types for null pointer value
360not_null<>: Allows to construct from a non-null underlying pointer
361not_null<>: Allows to construct from a non-null user-defined ref-counted type
362not_null<>: Allows to construct from a non-null related pointer
363not_null<>: Allows to construct from a not_null related pointer type
364not_null<>: Allows assignment from a not_null related pointer type
365not_null<>: Allows assignment from a non-null bare recast pointer
366not_null<>: Allows implicit conversion to underlying type
367not_null<>: Allows indirect member access
368not_null<>: Allows dereferencing
369not_null<>: Allows to compare equal to another not_null of the same type
370not_null<>: Allows to compare unequal to another not_null of the same type
371not_null<>: Allows to compare less than another not_null of the same type
372not_null<>: Allows to compare less than or equal to another not_null of the same type
373not_null<>: Allows to compare greater than another not_null of the same type
374not_null<>: Allows to compare greater than or equal to another not_null of the same type
375not_null<>: Allows to compare equal to a raw pointer of the same type
376not_null<>: Allows to compare unequal to a raw pointer of the same type
377not_null<>: Allows to compare less than a raw pointer of the same type
378not_null<>: Allows to compare less than or equal to a raw pointer of the same type
379not_null<>: Allows to compare greater than a raw pointer of the same type
380not_null<>: Allows to compare greater than or equal to a raw pointer of the same type
381owner<>: Allows its use as the (pointer) type it stands for
382Owner(): Allows its use as the (pointer) type it stands for
383owner<>: Disallows construction from a non-pointer type (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
384span<>: Disallows construction from a temporary value (C++11) (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
385span<>: Disallows construction from a C-array of incompatible type (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
386span<>: Disallows construction from a std::array of incompatible type (C++11) (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
387span<>: Terminates construction from a nullptr and a non-zero size (C++11)
388span<>: Terminates construction from two pointers in the wrong order
389span<>: Terminates construction from a null pointer and a non-zero size
390span<>: Terminates creation of a sub span of the first n elements for n exceeding the span
391span<>: Terminates creation of a sub span of the last n elements for n exceeding the span
392span<>: Terminates creation of a sub span outside the span
393span<>: Terminates access outside the span
394span<>: Allows to default-construct
395span<>: Allows to construct from a nullptr and a zero size (C++11)
396span<>: Allows to construct from a l-value (C++11)
397span<>: Allows to construct from a const l-value (C++11)
398span<>: Allows to construct from two pointers
399span<>: Allows to construct from two pointers to const
400span<>: Allows to construct from a non-null pointer and a size
401span<>: Allows to construct from a non-null pointer to const and a size
402span<>: Allows to construct from a temporary pointer and a size
403span<>: Allows to construct from a temporary pointer to const and a size
404span<>: Allows to construct from any pointer and a zero size
405span<>: Allows to construct from a C-array
406span<>: Allows to construct from a const C-array
407span<>: Allows to construct from a C-array with size via decay to pointer (potentially dangerous)
408span<>: Allows to construct from a const C-array with size via decay to pointer (potentially dangerous)
409span<>: Allows to construct from a std::array<> (C++11)
410span<>: Allows to construct from a std::array<> with const data (C++11)
411span<>: Allows to construct from a container (std::vector<>)
412span<>: Allows to tag-construct from a container (std::vector<>)
413span<>: Allows to construct from an empty gsl::shared_ptr (C++11)
414span<>: Allows to construct from an empty gsl::unique_ptr (C++11)
415span<>: Allows to construct from an empty gsl::unique_ptr (array, C++11)
416span<>: Allows to construct from a non-empty gsl::shared_ptr (C++11)
417span<>: Allows to construct from a non-empty gsl::unique_ptr (C++11)
418span<>: Allows to construct from a non-empty gsl::unique_ptr (array, C++11)
419span<>: Allows to copy-construct from another span of the same type
420span<>: Allows to copy-construct from another span of a compatible type
421span<>: Allows to move-construct from another span of the same type (C++11)
422span<>: Allows to copy-assign from another span of the same type
423span<>: Allows to move-assign from another span of the same type (C++11)
424span<>: Allows to create a sub span of the first n elements
425span<>: Allows to create a sub span of the last n elements
426span<>: Allows to create a sub span starting at a given offset
427span<>: Allows to create a sub span starting at a given offset with a given length
428span<>: Allows to create an empty sub span at full offset
429span<>: Allows to create an empty sub span at full offset with zero length
430span<>: Allows forward iteration
431span<>: Allows const forward iteration
432span<>: Allows reverse iteration
433span<>: Allows const reverse iteration
434span<>: Allows to observe an element via array indexing
435span<>: Allows to observe an element via call indexing
436span<>: Allows to observe an element via at()
437span<>: Allows to observe an element via data()
438span<>: Allows to change an element via array indexing
439span<>: Allows to change an element via call indexing
440span<>: Allows to change an element via at()
441span<>: Allows to change an element via data()
442span<>: Allows to compare equal to another span of the same type
443span<>: Allows to compare unequal to another span of the same type
444span<>: Allows to compare less than another span of the same type
445span<>: Allows to compare less than or equal to another span of the same type
446span<>: Allows to compare greater than another span of the same type
447span<>: Allows to compare greater than or equal to another span of the same type
448span<>: Allows to compare to another span of the same type and different cv-ness (non-standard)
449span<>: Allows to compare empty spans as equal
450span<>: Allows to test for empty span via empty(), empty case
451span<>: Allows to test for empty span via empty(), non-empty case
452span<>: Allows to obtain the number of elements via size()
453span<>: Allows to obtain the number of elements via length()
454span<>: Allows to obtain the number of bytes via size_bytes()
455span<>: Allows to obtain the number of bytes via length_bytes()
456span<>: Allows to swap with another span of the same type
457span<>: Allows to view the elements as read-only bytes
458span<>: Allows to view and change the elements as writable bytes
459span<>: Allows to view the elements as a span of another type
460span<>: Allows to change the elements from a span of another type
461span<>: Allows to copy a span to another span of the same element type
462span<>: Allows to copy a span to another span of a different element type
463make_span(): Allows building from two pointers
464make_span(): Allows building from two const pointers
465make_span(): Allows building from a non-null pointer and a size
466make_span(): Allows building from a non-null const pointer and a size
467make_span(): Allows building from a C-array
468make_span(): Allows building from a const C-array
469make_span(): Allows building from a std::array<> (C++11)
470make_span(): Allows building from a const std::array<> (C++11)
471make_span(): Allows building from a container (std::vector<>)
472make_span(): Allows building from a const container (std::vector<>)
473make_span(): Allows building from an empty gsl::shared_ptr (C++11)
474make_span(): Allows building from an empty gsl::unique_ptr (C++11)
475make_span(): Allows building from an empty gsl::unique_ptr (array, C++11)
476make_span(): Allows building from a non-empty gsl::shared_ptr (C++11)
477make_span(): Allows building from a non-empty gsl::unique_ptr (C++11)
478make_span(): Allows building from a non-empty gsl::unique_ptr (array, C++11)
479string_span: Disallows construction of a string_span from a cstring_span (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
480string_span: Disallows construction of a string_span from a const std::string (define gsl_CONFIG_CONFIRMS_COMPILATION_ERRORS)
481string_span: Allows to default-construct
482string_span: Allows to construct from a nullptr (C++11)
483string_span: Allows to construct a cstring_span from a const C-string
484string_span: Allows to construct a string_span from a non-const C-string and size
485string_span: Allows to construct a string_span from a non-const C-string begin and end pointer
486string_span: Allows to construct a string_span from a non-const C-array
487string_span: Allows to construct a string_span from a non-const std::string
488string_span: Allows to construct a string_span from a non-const std::array (C++11)
489string_span: Allows to construct a string_span from a non-const container (std::vector)
490string_span: Allows to construct a string_span from a non-const container, via a tag (std::vector)
491string_span: Allows to construct a cstring_span from a non-const C-string and size
492string_span: Allows to construct a cstring_span from a non-const C-string begin and end pointer
493string_span: Allows to construct a cstring_span from a non-const C-array
494string_span: Allows to construct a cstring_span from a non-const std::string
495string_span: Allows to construct a cstring_span from a non-const std::array (C++11)
496string_span: Allows to construct a cstring_span from a non-const container (std::vector)
497string_span: Allows to construct a cstring_span from a non-const container, via a tag (std::vector)
498string_span: Allows to construct a cstring_span from a const C-string and size
499string_span: Allows to construct a cstring_span from a non-const C-string begin and end pointer
500string_span: Allows to construct a cstring_span from a const C-array
501string_span: Allows to construct a cstring_span from a const std::string
502string_span: Allows to construct a cstring_span from a const std::array (C++11)
503string_span: Allows to construct a cstring_span from a const container (std::vector)
504string_span: Allows to construct a cstring_span from a const container, via a tag (std::vector)
505string_span: Allows to construct a wstring_span from a non-const C-string and size
506string_span: Allows to construct a wstring_span from a non-const C-string begin and end pointer
507string_span: Allows to construct a wstring_span from a non-const C-array
508string_span: Allows to construct a wstring_span from a non-const std::wstring
509string_span: Allows to construct a wstring_span from a non-const std::array (C++11)
510string_span: Allows to construct a wstring_span from a non-const container (std::vector)
511string_span: Allows to construct a wstring_span from a non-const container, via a tag (std::vector)
512string_span: Allows to construct a cwstring_span from a non-const C-string and size
513string_span: Allows to construct a cwstring_span from a non-const C-string begin and end pointer
514string_span: Allows to construct a cwstring_span from a non-const C-array
515string_span: Allows to construct a cwstring_span from a non-const std::wstring
516string_span: Allows to construct a cwstring_span from a non-const std::array (C++11)
517string_span: Allows to construct a cwstring_span from a non-const container (std::vector)
518string_span: Allows to construct a cwstring_span from a non-const container, via a tag (std::vector)
519string_span: Allows to construct a cwstring_span from a const C-string and size
520string_span: Allows to construct a cwstring_span from a const C-string begin and end pointer
521string_span: Allows to construct a cwstring_span from a const C-array
522string_span: Allows to construct a cwstring_span from a const std::wstring
523string_span: Allows to construct a cwstring_span from a const std::array (C++11)
524string_span: Allows to construct a cwstring_span from a const container (std::vector)
525string_span: Allows to construct a cwstring_span from a const container, via a tag (std::vector)
526string_span: Allows to copy-construct from another span of the same type
527string_span: Allows to copy-construct from another span of a compatible type
528string_span: Allows to move-construct from another span of the same type (C++11)
529string_span: Allows to copy-assign from another span of the same type
530string_span: Allows to move-assign from another span of the same type (C++11)
531string_span: Allows to create a sub span of the first n elements
532string_span: Allows to create a sub span of the last n elements
533string_span: Allows to create a sub span starting at a given offset
534string_span: Allows to create a sub span starting at a given offset with a given length
535string_span: Allows to create an empty sub span at full offset
536string_span: Allows to create an empty sub span at full offset with zero length
537string_span: Allows forward iteration
538string_span: Allows const forward iteration
539string_span: Allows reverse iteration
540string_span: Allows const reverse iteration
541string_span: Allows to observe an element via array indexing
542string_span: Allows to observe an element via call indexing
543string_span: Allows to observe an element via data()
544string_span: Allows to change an element via array indexing
545string_span: Allows to change an element via call indexing
546string_span: Allows to change an element via data()
547string_span: Allows to compare a string_span with another string_span
548string_span: Allows to compare empty spans as equal
549string_span: Allows to compare a string_span with a cstring_span
550string_span: Allows to compare with types convertible to string_span
551string_span: Allows to test for empty span via empty(), empty case
552string_span: Allows to test for empty span via empty(), non-empty case
553string_span: Allows to obtain the number of elements via length()
554string_span: Allows to obtain the number of elements via size()
555string_span: Allows to obtain the number of bytes via length_bytes()
556string_span: Allows to obtain the number of bytes via size_bytes()
557string_span: Allows to view the elements as read-only bytes
558to_string(): Allows to explicitly convert from string_span to std::string
559to_string(): Allows to explicitly convert from cstring_span to std::string
560to_string(): Allows to explicitly convert from wstring_span to std::wstring
561to_string(): Allows to explicitly convert from cwstring_span to std::wstring
562ensure_z(): Disallows to build a string_span from a const C-string
563ensure_z(): Disallows to build a wstring_span from a const wide C-string
564ensure_z(): Allows to build a string_span from a non-const C-string
565ensure_z(): Allows to build a cstring_span from a non-const C-string
566ensure_z(): Allows to build a cstring_span from a const C-string
567ensure_z(): Allows to build a wstring_span from a non-const wide C-string
568ensure_z(): Allows to build a cwstring_span from a non-const wide C-string
569ensure_z(): Allows to build a cwstring_span from a const wide C-string
570ensure_z(): Allows to specify ultimate location of the sentinel and ensure its presence
571operator<<: Allows printing a string_span to an output stream
572operator<<: Allows printing a cstring_span to an output stream
573operator<<: Allows printing a wstring_span to an output stream
574operator<<: Allows printing a cwstring_span to an output stream
575finally: Allows to run lambda on leaving scope
576finally: Allows to run function (bind) on leaving scope
577finally: Allows to run function (pointer) on leaving scope
578finally: Allows to move final_act
579on_return: Allows to perform action on leaving scope without exception (gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD)
580on_error: Allows to perform action on leaving scope via an exception (gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD)
581narrow_cast<>: Allows narrowing without value loss
582narrow_cast<>: Allows narrowing with value loss
583narrow<>(): Allows narrowing without value loss
584narrow<>(): Terminates when narrowing with value loss
585narrow<>(): Terminates when narrowing with sign loss
586```
587