This answer answer that why C++20 introduced the std::ssize()
, but according to latest std::span
's specification, the size_type
of std::span
is now unsigned std::size_t
, so is there other use case for std::ssize()
?
Asked
Active
Viewed 120 times
0

康桓瑋
- 33,481
- 5
- 40
- 90
-
1Does this answer your question? https://stackoverflow.com/questions/56217283/why-is-stdssize-introduced-in-c20 – 463035818_is_not_an_ai Dec 18 '20 at 09:38
-
1isnt this the same question as the one you link? – 463035818_is_not_an_ai Dec 18 '20 at 09:38
-
4You didn't read the answer right. Contrary to the original form of the proposal, the Standardised `span.size()` ended up being unsigned, as in other containers. However, `ssize()` was **added** to avoid the various pitfalls already well known with unsigned sizes. – underscore_d Dec 18 '20 at 09:39
-
3`ssisze` was not introduced even though `size_type` is `unsigned`, but because `size_type` is `unsigned` – 463035818_is_not_an_ai Dec 18 '20 at 09:52