为什么 std::span 缺少 size_type?

Why does std::span lack size_type?

我一直在将使用我的自制软件 span class 的旧代码更新为更符合 C++20 std::span 的代码,但我遇到了编译错误,因为 std::span 没有 size_type 而有 index_type。关于是否应该签署 index_type 已经发生了一场巨大的戏剧性事件,但为什么要跳过 size_type?这打破了期望容器(或类似容器的对象)具有 size_type.

的通用代码

原提案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 P1227R2index_type改为size_t

Nevin 所说的一切......并且已在 Belfast 中修复。