I've been updating old code that used my homebrew span class to the one that is more in line with C++20 std::span
and I'm getting compile errors because std::span
doesn't have size_type
and instead has index_type
. There's been a huge drama over whether index_type
should be signed or not, but why skipping size_type
? This breaks generic code that expects containers (or container-like objects) to have size_type
.
The original proposal P1022R0 , back when it was called array_view
, had a size_type
member. It was removed in the first revision P1022R1 as part of the simplification, as it wasn't needed because size()
and element access were, at that time, using the signed index_type
(aka ptrdiff_t
). At the Kona 2019 meeting, that decision was changed in P1227R2 by changing index_type
to be size_t
.
内文所说的一切……而且在贝尔法斯特得到了解决。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.