You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -19829,7 +19839,7 @@ The array `arr` is not a C-style string because it is not zero-terminated.
19829
19839
19830
19840
##### Alternative
19831
19841
19832
-
See [`zstring`](#Rstr-zstring), [`string`](#Rstr-string), and [`string_view`](#Rstr-view).
19842
+
See [`zstring`](#Rstr-zstring), [`string`](#Rstr-string), and [`string_span`](#Rstr-view).
19833
19843
19834
19844
##### Enforcement
19835
19845
@@ -19873,7 +19883,7 @@ C++17
19873
19883
19874
19884
???
19875
19885
19876
-
### <a name="Rstr-span"></a>SL.str.11: Use `gsl::span<char>` rather than `std::string_view` when you need to mutate a string
19886
+
### <a name="Rstr-span"></a>SL.str.11: Use `gsl::string_span` rather than `std::string_view` when you need to mutate a string
19877
19887
19878
19888
##### Reason
19879
19889
@@ -20904,6 +20914,8 @@ If something is not supposed to be `nullptr`, say so:
20904
20914
20905
20915
* `span<T>` // `[p:p+n)`, constructor from `{p, q}` and `{p, n}`; `T` is the pointer type
20906
20916
* `span_p<T>` // `{p, predicate}` `[p:q)` where `q` is the first element for which `predicate(*p)` is true
20917
+
* `string_span` // `span<char>`
20918
+
* `cstring_span` // `span<const char>`
20907
20919
20908
20920
A `span<T>` refers to zero or more mutable `T`s unless `T` is a `const` type.
20909
20921
@@ -21699,9 +21711,9 @@ Because we want to use them immediately, and because they are temporary in that
21699
21711
21700
21712
No. The GSL exists only to supply a few types and aliases that are not currently in the standard library. If the committee decides on standardized versions (of these or other types that fill the same need) then they can be removed from the GSL.
21701
21713
21702
-
### <a name="Faq-gsl-string-view"></a>FAQ.55: If you're using the standard types where available, why is the GSL `span<char>` different from the `string_view` in the Library Fundamentals 1 Technical Specification and C++17 Working Paper? Why not just use the committee-approved `string_view`?
21714
+
### <a name="Faq-gsl-string-view"></a>FAQ.55: If you're using the standard types where available, why is the GSL `string_span` different from the `string_view` in the Library Fundamentals 1 Technical Specification and C++17 Working Paper? Why not just use the committee-approved `string_view`?
21703
21715
21704
-
The consensus on the taxonomy of views for the C++ Standard Library was that "view" means "read-only", and "span" means "read/write". If you only need a read-only view of characters that does not need guaranteed bounds-checking and you have C++17, use C++17 `std::string_view`. Otherwise, if you need a read-write view that does not need guaranteed bounds-checking and you have C++20, use C++20 `std::span<char>`. Otherwise, use `gsl::span<char>`.
21716
+
The consensus on the taxonomy of views for the C++ Standard Library was that "view" means "read-only", and "span" means "read/write". The read-only `string_view` was the first such component to complete the standardization process, while `span` and `string_span` are currently being considered for standardization.
21705
21717
21706
21718
### <a name="Faq-gsl-owner"></a>FAQ.56: Is `owner` the same as the proposed `observer_ptr`?
21707
21719
@@ -22220,7 +22232,7 @@ Better:
22220
22232
A checker must consider all "naked pointers" suspicious.
22221
22233
A checker probably must rely on a human-provided list of resources.
22222
22234
For starters, we know about the standard-library containers, `string`, and smart pointers.
22223
-
The use of `span` and `string_view` should help a lot (they are not resource handles).
22235
+
The use of `span` and `string_span` should help a lot (they are not resource handles).
22224
22236
22225
22237
### <a name="Cr-raw"></a>Discussion: A "raw" pointer or reference is never a resource handle
0 commit comments